Skip to content
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

Lines with ::class constant are not covered #793

Closed
ingowalther opened this issue Aug 13, 2020 · 11 comments
Closed

Lines with ::class constant are not covered #793

ingowalther opened this issue Aug 13, 2020 · 11 comments
Assignees

Comments

@ingowalther
Copy link

Q A
php-code-coverage version 9.1.3
PHP version 7.4.3
Driver Xdebug and pcov
Xdebug version (if used) 2.9.2
pcov version 1.0.6
Installation Method PHPUnit PHAR
Usage Method PHPUnit
PHPUnit version (if used) 9.3.7

Since the Update to PHPUnit 9.3.7 the Coverage-Report does not contain all lines.

Since the update the report looks like this (line 115 is missing):
image

Before it looked like this (line 115 is covered):
Screenshot_2020-08-13_12-05-54

Before the Update the PHPUnit PHAR was used in Version 9.2.6

@sebastianbergmann
Copy link
Owner

Thank you for your report.

Please provide a minimal, self-contained, reproducing test case that shows the problem you are reporting.

Without such a minimal, self-contained, reproducing test case I will not be able to investigate this issue.

@sebastianbergmann
Copy link
Owner

Also, please test with recent versions of PHP and Xdebug. php-code-coverage no longer works around bug in Xdebug, for instance, that have been fixed in newer versions.

@ingowalther
Copy link
Author

This behavior always occurs when "XXX::class" is used.
image

I checked the behavior again with PHP 7.4.9 and Xdebug 2.9.6 and the problem is still there.

Here is my minimal test case:
minimal-test-case.zip

@sebastianbergmann
Copy link
Owner

CC @derickr @dvdoug

@dvdoug
Copy link
Contributor

dvdoug commented Aug 13, 2020

OK, that's gonna be the same as #794 then

@dvdoug
Copy link
Contributor

dvdoug commented Aug 13, 2020

And I'm going to put money on https://github.com/sebastianbergmann/php-code-coverage/blob/master/src/StaticAnalysis/ParsingCoveredFileAnalyser.php#L216 not working the same as when the same workaround was used under PHP_Token_Stream.

@sebastianbergmann
Copy link
Owner

You're probably right, I'll have a look. Thanks for the pointer!

@dvdoug
Copy link
Contributor

dvdoug commented Aug 13, 2020

Yeah before this construct was identified as PHP_Token_CLASS_NAME_CONSTANT so wasn't affected

@sebastianbergmann sebastianbergmann changed the title Lines missing in coverage Lines with ::class constant are not covered Aug 13, 2020
@sebastianbergmann sebastianbergmann self-assigned this Aug 13, 2020
@sebastianbergmann
Copy link
Owner

Can you please test with 081faa0? Thanks!

@ingowalther
Copy link
Author

I can confirm that the problem no longer occurs!

Thank you very much!

@dominikzogg
Copy link

tested #794 with phpdbg, its also fixed with this commit, thank you @sebastianbergmann

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants