Skip to content

Instantly share code, notes, and snippets.

Created November 21, 2022 10:45
What would you like to do?
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