phpunitHow to generate a coverage report with PHPUnit?
PHPUnit provides a way to generate a coverage report to measure the amount of code covered by tests. To generate a coverage report, the --coverage-html
option must be used when running the tests.
phpunit --coverage-html ./report
This will generate a coverage report in the ./report
directory. The report will contain information about the lines of code executed, classes, methods, and functions.
Code explanation
--coverage-html
: This option is used to generate a coverage report../report
: This is the directory where the report will be generated.
Helpful links
More of Phpunit
- How to skip a PHPUnit test?
- How to run tests in parallel with PHPUnit?
- How to use hooks in PHPUnit?
- What are PHPUnit required extensions
- How to use the PHPUnit Framework TestCase?
- How to run PHPUnit in quiet mode?
- How to show warnings in PHPUnit?
- How to load fixtures with PHPUnit?
- How to use a listener with PHPUnit?
- How to stop PHPUnit on failure?
See more codes...