2017 © Pedro Peláez
 

project codecoverage

Creating code coverage reports (html) by using xdebug

image

vitalyspirin/codecoverage

Creating code coverage reports (html) by using xdebug

  • Thursday, July 28, 2016
  • by vitalyspirin
  • Repository
  • 1 Watchers
  • 0 Stars
  • 38 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

CodeCoverage

Wrapper classes around xDebug to show code coverage data as html files., (*1)

Installation

composer require vitalyspirin/codecoverage

To generate HTML reports and see them in a table you can put file examples/reporting.php on the same level as a directory for code coverage reports. Then in a browser navigate to reporting.php., (*2)

Inside directory for code coverage reports you can create file 'userstory' with the word "off" as a content to disable code coverage (and speed up execution)., (*3)

Quick Start and Examples

use vitalyspirin\codecoverage\CodeCoverage;

$reportDir = 'CodeCoverageReports';  // directory for report files 
CodeCoverage::deleteAllReports($reportDir); // remove this if you need cumulative coverage
CodeCoverage::start();

$a = new A();

CodeCoverage::stop();
CodeCoverage::deleteTxtReports(); // remove this if you need cumulative coverage
CodeCoverage::$trackedFileList['test2'] = [];
CodeCoverage::$trackedFileList['test2'][] = realpath(dirname(__FILE__) . '/A.php');

$reportDir = 'CodeCoverageReports';  // directory for report files 
CodeCoverage::start($reportDir, "test2"); // "test2" is used to indicate which files should be analyzed.

$a = new A();

CodeCoverage::stop();

General way to put it into main router (index.php):, (*4)

require_once(__DIR__ . '/vendor/vitalyspirin/codecoverage/src/CodeCoverage.php');

vitalyspirin\codecoverage\CodeCoverage::start(__DIR__ . '/codecoverage');

register_shutdown_function(function() {
    vitalyspirin\codecoverage\CodeCoverage::stop();
});

Screenshot

screenshot1.png, (*5)

The Versions

28/07 2016

dev-master

9999999-dev https://github.com/vitalyspirin/codecoverage

Creating code coverage reports (html) by using xdebug

  Sources   Download

The Requires

  • php >=5.3.0

 

php xdebug code coverage

12/07 2016

2.0.1

2.0.1.0 https://github.com/vitalyspirin/codecoverage

Creating code coverage reports (html) by using xdebug

  Sources   Download

The Requires

  • php >=5.3.0

 

php xdebug code coverage

27/06 2016

2.0.0

2.0.0.0 https://github.com/vitalyspirin/codecoverage

Creating code coverage reports (html) by using xdebug

  Sources   Download

The Requires

  • php >=5.3.0

 

php xdebug code coverage

25/06 2016

1.0.0

1.0.0.0 https://github.com/vitalyspirin/codecoverage

Creating code coverage reports (html) by using xdebug

  Sources   Download

The Requires

  • php >=5.3.0

 

php xdebug code coverage