willpower232 / cloverparser
An extensible class for totalling the unit test coverage from Clover files
Requires
- php: ^7.4 || ^8.0
- ext-xml: *
Requires (Dev)
- php-parallel-lint/php-parallel-lint: ^1.3
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^10.0 || ^11.0
- robiningelbrecht/phpunit-coverage-tools: ^1.8
- squizlabs/php_codesniffer: ^3.6
README
This is a parser for one or more clover coverage files, as generated by phpunit/phpunit, with the aim of producing a percentage for code coverage.
This is intended to be the basis of parsing some clover files for use in other ways such as willpower232/cloverparser-laravel which creates an SVG from the coverage percentage and stores it using Laravels framework.
A former casual user of codecov and interested in controlling my own data, I decided to see how complicated it would be to operate a similar setup myself after their uploader script was compromised.
This is the first part of this project, discovering how to get the coverage values out of a clover file.
Installation
composer require willpower232/cloverparser
Usage
use WillPower232\CloverParser\CloverParser; $parser = new CloverParser; $parser->addFile($pathToCloverFile); $percentage = $parser->getPercentage();