dimanche 28 janvier 2018

Generate PHPUnit code coverage while ignoring @covers

I am generating code coverage reports with PHPUnit

vendor/bin/phpunit --coverage-clover coverage.clover

I have a few codebase that use the @covers tag in their tests, indicating the service they test. In these codebases there are no dedicated tests for things such as value objects. This results in the coverage reports indicating a lot of code as not tested, while in fact it is. This makes it hard to find actual untested code by looking at the coverage reports. One way to fix this is to remove the @covers tags, though these are useful to indicate intent and they aid navigation as the IDE recognizes them. Hence I would like PHPUnit to ignore the tags.

I found that there is a --disable-coverage-ignore flag, which makes PHPUnit ignore the coverage ignore tags. What I am looking for is essentially the opposite.

Is there a way to generate code coverage reports that count all executed lines without making changes through these entire codebases such as removing all @covers tags?

Aucun commentaire:

Enregistrer un commentaire