PHP code example of phpunit / php-code-coverage

1. Go to this page and download the library: Download phpunit/php-code-coverage 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/ */

    

phpunit / php-code-coverage example snippets


 declare(strict_types=1);
use SebastianBergmann\CodeCoverage\CodeCoverage;
use SebastianBergmann\CodeCoverage\Driver\Selector as DriverSelector;
use SebastianBergmann\CodeCoverage\Filter;
use SebastianBergmann\CodeCoverage\Report\Facade as ReportFacade;

$filter = new Filter;

$filter->penClover('/tmp/openclover.xml');

 declare(strict_types=1);
use SebastianBergmann\CodeCoverage\Report\Facade as ReportFacade;
use SebastianBergmann\CodeCoverage\Serialization\Unserializer;

$data = (new Unserializer)->unserialize('/path/to/coverage.php');

ReportFacade::fromSerializedData($data)->renderOpenClover('/tmp/openclover.xml');

composer