-
-
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 8.5.24 PHAR on PHP 7 #4934
Comments
Thank you for bringing this to my attention! This was missed in CI because we did not test the PHAR with code coverage. As of 995d322 we now do. |
This is (likely|almost certainly) related to the new version of PHP-Scoper being used. I will look into this ASAP. |
Great, thanks for the quick response! |
Thanks for fixing this! Are you planning to do a 8.5.25 release soon-ish? |
PHPUnit 8.5.25 with this fix was released yesterday. |
Oh, right. Thanks a lot! |
Summary
There appears to be a regression in PHPUnit 8.5.24 (compared to 8.5.23) when installed from PHAR. Enabling any coverage reports will cause all tests to fail. The error messages are related to php-token-stream; I suspect that something is wrong with the bundling of php-token-stream within the PHAR. I couldn't reproduce this when PHPUnit was installed via Composer.
Originally I found this problem when investigating why GitHub Actions CI tests for the Skosmos project started failing a few days ago, coinciding with the 8.5.24 release (see NatLibFi/Skosmos#1288 for background and details) but I was eventually able to reproduce the problem with a much more minimal test case that I'm reporting here.
Current behavior
Here is an example of broken tests:
How to reproduce
Preconditions: PHP 7.x (seems to affect all of 7.2, 7.3 and 7.4), PHPUnit 8.5.24 installed from PHAR, and either XDebug or PCOV is installed so that coverage collection is possible.
Here is a very simple test project based on the PHPUnit 8 tutorial.
src/Email.php (unchanged from tutorial):
tests/EmailTest.php (unchanged from tutorial):
src/autoload.php (hand-crafted):
Expected behavior
This is how it works with PHPUnit 8.5.23 and how I expect it should work also with the newest version:
The text was updated successfully, but these errors were encountered: