Last active
December 9, 2021 19:38
-
-
Save scmrus/ec4882d02f951bdbb783296f7da1a1c4 to your computer and use it in GitHub Desktop.
xdebug-code-coverage (global)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$_xdebug_code_coverage = new class { | |
private $coverage; | |
private $covFile; | |
public function __construct() | |
{ | |
require_once __DIR__ . '/../vendor/autoload.php'; | |
$uid = uniqid(); | |
$this->covFile = "/tmp/xdebug-code-coverage/${uid}.cov"; | |
$this->coverage = new \SebastianBergmann\CodeCoverage\CodeCoverage; | |
$this->coverage->filter()->addDirectoryToWhitelist(__DIR__ . '/../app'); | |
$this->coverage->filter()->addDirectoryToWhitelist(__DIR__ . '/../batch'); | |
$this->coverage->start($uid); | |
} | |
public function __destruct() | |
{ | |
$this->coverage->stop(); | |
(new \SebastianBergmann\CodeCoverage\Report\PHP)->process($this->coverage, $this->covFile); | |
} | |
}; |
to merge all data into one report:
./vendor/bin/phpcov merge --html ./coverage-report /tmp/xdebug-code-coverage/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
xdebug.ini: