-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code Coverage does not work with PHPUnit 9.3 PHAR and Xdebug #4404
Comments
Probably also caused by humbug/php-scoper#399. |
@sebastianbergmann Please let me know if you'd like me to test a new phar before release (once available). |
Looks like this is not related to humbug/php-scoper#399, but still to PHP-Scoper. The version of @theofidry (or somebody else familiar with PHP-Scoper, maybe @sebastianfeldmann?) Can you tell what I need to work around this issue while we wait for a new release of PHP-Scoper? A pull request to either the PHP-Scoper configuration that PHPUnit uses or to PHPUnit's build automation where PHP-Scoper is used would be much appreciated. |
@jrfnl Thank you for offering to help, Juliette. Right now I do not know how to produce something for you test. |
@jrfnl In the meantime, you should probably be fine with using PCOV instead of Xdebug. |
@sebastianbergmann No worries & no rush. In the mean time, I'll just use PHPUnit 9.2.x to generate code coverage and I'll patiently anticipate the moment when I can run the tests with branch/path coverage ;-) |
@sebastianbergmann Just tested & found working. Thanks for the quick turn-around. I do have some observations. /cc @dvdoug 1. Old versus new configIf both the old as well as the new config are present, the new config is ignored (at least the I'd expect:
Reasoning: Of course, this can be done with a separate
2. Memory usageI'm not surprised that the path/branch coverage uses up more memory, I am surprised at the amount and wonder if there is a memory leak somewhere. First coverage run with the old config active (no path/branch coverage):
Second coverage run with the new config active, results straight away in a Mind: this error appears before any tests are even run. Third coverage run with the new config active and
Are these known issues ? and/or design/implementation choices ? Or should I open issues for these ? |
Peak memory usage is because the array emitted from Xdebug with all of the data...is large. Commenting out https://github.com/sebastianbergmann/php-code-coverage/blob/master/src/RawCodeCoverageData.php#L55 so that the additional data is discarded immediately after collection doesn't affect memory usage in my testing. |
A You know what I think about wanting to support multiple PHP versions and multiple PHPUnit versions in the same codebase. We disagree on this topic and all I can say is: I am sorry that this not convenient to deal with in an environment such as yours, but it is not a use case that I want to handle or optimize for.
Xdebug needs to do a lot more work when branch/path coverage is used. That being said, code coverage performance issues are out of scope for this issue tracker as the respective functionality is implemented in php-code-coverage.
php-code-coverage performs pre-processing of the sourcecode files that are configured in
Yes. There is also a performance-related issue that is not limited to branch/path coverage: sebastianbergmann/php-code-coverage#789 |
You still need to know the version in use, but you can keep using the 9.2 config and pass |
Summary
When attempting to create a code coverage report, the run exits nearly immediately with a
Fatal error: Uncaught Error: Call to undefined function PHPUnit\xdebug_set_filter()
.I was looking forward to exploring the new path/branch coverage. Unfortunately ran into this before even adding the new
pathCoverage="true"
config option.Current behavior
How to reproduce
Using the latest PHPUnit 9.3.x phar, run the
phpunit --disallow-test-output --coverage-html ./build/coverage-html/
command on a project.Relevant part of the
phpunit.xml
config file used for the run:Expected behavior
That the tests would be run and a code coverage report would be created.
The text was updated successfully, but these errors were encountered: