Download the PHP package gotrendier/phpunit-coverage-check without Composer
On this page you can find all versions of the php package gotrendier/phpunit-coverage-check. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gotrendier/phpunit-coverage-check
More information about gotrendier/phpunit-coverage-check
Files in gotrendier/phpunit-coverage-check
Package phpunit-coverage-check
Short Description Check the code coverage using the clover report of phpunit
License MIT
Informations about the package phpunit-coverage-check
phpunit-coverage-check
This php script will read the clover xml report from phpunit and calculates the coverage score. Based on the given threshold the script will exit ok of the coverage is higher then the threshold or exit with code 1 if the coverage is lower then the threshold. This script can be used in your continuous deployment environment or for example added to a pre-commit hook.
Installation
The script can be installed using composer. Add this repository as a dependency to the composer.json file.
Usage
The script has requires 2 parameters that are mandatory to return the code coverage.
- The location of the clover xml file, that's generated by phpunit.
- The coverage threshold that is acceptable. Min = 1, Max = 100
Generate the clover.xml
file by using phpunit and run the coverage check script:
Run the script:
With the --only-percentage
enabled, the CLI command will only return the resulting coverage percentage.
By default, chictrend
folder will be measured. If you pass a folder like app
after de percentage argument or--only-percentage
argument that folder will be measured.
It's also possible to add the coverage report generation to the phpunit.xml.dist add to following line to the xml file:
For more information see the phpunit documentation. Information about the configuration file and commandline options.