Skip to content

Instantly share code, notes, and snippets.

Created November 21, 2022 10:45
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save derickr/d5fbab31f50e414acedbab99ac0fc596 to your computer and use it in GitHub Desktop.
require 'vendor/autoload.php';
use SebastianBergmann\CodeCoverage\Filter;
use SebastianBergmann\CodeCoverage\Driver\Selector;
use SebastianBergmann\CodeCoverage\CodeCoverage;
use SebastianBergmann\CodeCoverage\Report\PHP as PhpReport;
$filter = new Filter;
$filter->includeDirectory( __DIR__ . '/html' );
$filter->includeDirectory( __DIR__ . '/src' );
$filter->includeDirectory( __DIR__ . '/views' );
$coverage = new CodeCoverage(
(new Selector)->forLineCoverage($filter),
function save_coverage()
global $coverage;
(new PhpReport)->process($coverage, '/tmp/path/crawler/' . bin2hex(random_bytes(16)) . '.cov');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment