1

Im running tests separatedly:

phpunit --log-junit result.xml Class1Test.php --coverage-php coverage.php --coverage-html, /codecoverage/ --whitelist Class1.php
phpunit --log-junit result.xml Class2Test.php --coverage-php coverage.php --coverage-html, /codecoverage/ --whitelist Class2.php
phpunit --log-junit result.xml Class3Test.php --coverage-php coverage.php --coverage-html, /codecoverage/ --whitelist Class3.php

the problem is, the coverage (both .html and .php) always overwrites the last. Any chance to merge/append to the last instead?

1 Answer 1

1

Presently, PHPUnit doesn't allow it as you can see in the reports class creating the coverage files. For example : https://github.com/sebastianbergmann/php-code-coverage/blob/master/src/Report/Clover.php

And, AFAIK, PHPUnit doesn't provide a way to generate custom coverage reports to code it yourself.

I just opened a bug on phpunit bugtracker: https://github.com/sebastianbergmann/phpunit/issues/4041

Maintainers may be interested

Edit: This is considered as "out of scope" by Sebastian Bergman so there seem to remain two options to achieve your goal:

  • Run two phpunit runs and code something to merge the resulting coverages afterwards
  • Use another testing framework (Codeception for example)
Sign up to request clarification or add additional context in comments.

1 Comment

yea, right, I had to do it on my own. As I remember, I could get an "array" as output, and I merged on my own

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.