xp-forge / coverage
Coverage for the XP Framework
v1.1.3
2021-10-21 20:59 UTC
Requires
- php: >=7.0.0
- phpunit/php-code-coverage: ^9.2.2 | ^8.0 | ^7.0 | ^6.0 | ^5.3
- xp-framework/core: ^11.0 | ^10.0 | ^9.0 | ^8.0
- xp-framework/unittest: ^11.0 | ^10.0 | ^9.7
README
Code coverage for XP using XDebug. Based on Sebastian Bergmann's Code coverage library.
Installation
$ composer global require xp-forge/coverage
Next, make sure you have the XDebug Zend extension loaded via zend_extension
.
Usage
$ xp coverage -p src/main/php/unittest/ src/test/php [.....................] ♥: 21/21 run (0 skipped), 21 succeeded, 0 failed Memory used: 3839.68 kB (4050.93 kB peak) Time taken: 0.246 seconds Coverage: 84.72% lines covered (61/72) ┌──────────────────────────────────────────────────────┬─────────┬──────┐ │ Class │ % Lines │ Not │ ╞══════════════════════════════════════════════════════╪═════════╪══════╡ │ unittest.coverage.ClassName │ 100.00% │ │ │ unittest.coverage.CoverageDetails │ 100.00% │ │ │ unittest.coverage.CoverageListener │ 60.71% │ 11 │ └──────────────────────────────────────────────────────┴─────────┴──────┘
HTML Report
An optional HTML report can be generated like this.
$ xp coverage -p src/main/php -r ./coverage-report src/test/php/
Use it in order to find out how to improve your coverage.
Clover report
A clover report can be generated as well.
$ xp coverage -p src/main/php -c clover.xml src/test/php/