Is it possible to forcefully exclude a folder from PHPUnit\'s code coverage?
Problem I\'ve got is, that I have a Symfony 1.4 project, which has folders at ./lib/ve
These answers all seem to apply to older versions of PHPUnit
I was running PHPUnit 5.7.23
and had issues getting files included and excluded for phpunit
. The syntax seems to have changed substantially and is only partially backward compatible. I had a complex requirement where i needed to also included & excluded separate directories for code coverage (its a legacy system).
Here is what I required in phpunit.xml
:
./tests
./tests/blah/excluded_file_from_tests1.php
./tests/blah/excluded_file_from_tests2.php
./tests/blah/excluded_file_from_tests3.php
./common/lib/included_directory
./common/lib/included_directory/core/blah/excluded_directory
So:
I'm including ./tests
directory.tests
i wanted to exclude a set of files excluded_file_from_testsX.php
./common/lib/included_directory
So this seemed to work well when run via phpunit --coverage-html build/coverage