My tested code is full of finite static classes. and although we cannot reorganize it for better tests, I have an intermediate solution that conducts several small tests on its own process. and everything is working fine. but I do not get a coverage report as it overwrites another.
I am currently creating a report in clover, but I am very open to other reports.
my tests only work when phpunit runs like:
/home/y/bin/phpunit --coverage-html clover --coverage-clover clover/report.xml --include-path src/ tests/aTest.php OK (1 test, 1 assertions) /home/y/bin/phpunit --coverage-html clover --coverage-clover clover/report.xml --include-path src/ tests/bTest.php OK (1 test, 1 assertions) /home/y/bin/phpunit --coverage-html clover --coverage-clover clover/report.xml --include-path src/ tests/cTest.php OK (1 test, 1 assertions)
But this will cause each run to clear the report from the previous one. Therefore, I receive only a report for the latter. And if I try to run them since phpunit expects to generate a full report, I have a failure because all my classes include their own static ones.
/home/y/bin/phpunit --coverage-html clover --coverage-clover clover/report.xml --include-path src/ tests/ . (first test pass) PHP Fatal error: Cannot redeclare class Something make[1]: *** [phpunit_run] Error 255
(but will not work above even with --process-isolation --no-globals-backup , because thatβs not exactly what they mean ...). This is NOT another question about how to properly handle isolation on a php block. I work it fine several times, I just need a full coverage report :)
Is there a way to make tests work correctly (i.e. on multiple processes to avoid the hidden space of a global class declaration) as the first block of code, but still has an exhaustive report on code coverage?
Thank you!
source share