PHP code example of ciltocruz / phpunit-coverage-tools

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

    

ciltocruz / phpunit-coverage-tools example snippets


 

use RobinIngelbrecht\PHPUnitCoverageTools\MinCoverage\MinCoverageRule;

return [
    new MinCoverageRule(
        pattern: MinCoverageRule::TOTAL,
        minCoverage: 20,
        exitOnLowCoverage: true
    ),
    new MinCoverageRule(
        pattern: 'RobinIngelbrecht\PHPUnitCoverageTools\*',
        minCoverage: 80,
        exitOnLowCoverage: false
    ),
    new MinCoverageRule(
        pattern: 'RobinIngelbrecht\PHPUnitCoverageTools\Subscriber\Application\ApplicationFinishedSubscriber',
        minCoverage: 100,
        exitOnLowCoverage: true
    ),   
    new MinCoverageRule(
        pattern: 'RobinIngelbrecht\PHPUnitCoverageTools\*CommandHandler',
        minCoverage: 100,
        exitOnLowCoverage: true
    ),
];