1. Go to this page and download the library: Download esi/phpunit-coverage-check library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
esi / phpunit-coverage-check example snippets
/**
* Processes the coverage data with the given clover file and threshold, and returns the information
* similar to how the Console application will.
*
* This is mainly useful for those that may wish to use this library outside the CLI/Console or PHAR.
*/
public function nonConsoleCall(string $cloverFile, int $threshold = 100, bool $onlyPercentage = false): string
use Esi\CoverageCheck\CoverageCheck;
$check = new CoverageCheck();
$results = $check->nonConsoleCall(__DIR__ . '/tests/fixtures/clover.xml', 90);
echo $results; // Total code coverage is 90.32%
bash
$ php phpunit-coverage-check.phar /path/to/clover.xml 100
$ php phpunit-coverage-check.phar /path/to/clover.xml 100 --only-percentage
# -O for only-percentage works as well
$ php phpunit-coverage-check.phar /path/to/clover.xml 100 -O
# -F or show-files will display coverage per file, formatted in a table
$ php phpunit-coverage-check.phar /path/to/clover.xml 100 -F