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.
The script can be installed using composer.Add this repository as a dependency to the composer.json file.
composer require --dev rregeer/phpunit-coverage-check
composer install
The script has requires 2 parameters that are mandatory to return the code coverage.
Generate the clover xml by using phpunit and run the coverage check script: Run the script:
vendor/bin/phpunit --coverage-clover clover.xml
vendor/bin/coverage-check clover.xml 80
It's also possible to add the coverage report generation to the phpunit.xml.dist add to following line to the xml file:
<logging>
<log type="coverage-clover" target="clover.xml"/>
</logging>
For more information see the phpunit documentation.
Information about the configuration file and commandline options.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。