soyhuce / phpunit-to-cobertura
Generates a cobertura code coverage report from phpunit
Installs: 5 574
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 4
Forks: 3
Open Issues: 0
Requires
- php: ^7.3
- ext-dom: *
- phpunit/phpunit: ^9.3
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.17
This package is auto-updated.
Last update: 2024-10-29 06:05:56 UTC
README
Some modern workflows need test coverage report to be generated with Cobertura. Phpunit does not support (yet ?) Cobertura report generation.
This project aims to solve this.
Installation
Via composer :
composer require --dev soyhuce/phpunit-to-cobertura
That's all !
Generating a Cobertura coverage report
First, you need to run your phpunit tests with code coverage enabled. This needs to generate (at least) the code coverage in php format.
<coverage processUncoveredFiles="true"> <include> <directory suffix=".php">src</directory> </include> <report> <php outputFile="./phpunit/codeCoverage.php"/> </report> </coverage>
Once done, you can convert the php code coverage into a Cobertura coverage.
./vendor/bin/phpunit-to-cobertura ./phpunit/codeCoverage.php ./phpunit/coberturaCoverage.xml
Support
Fow now, only PHPUnit 9.3 is supported.
Contributing
You are welcome to contribute to this project ! Please see CONTRIBUTING.md.
License
This package is provided under the MIT License