-
-
Notifications
You must be signed in to change notification settings - Fork 376
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
CodeCoverage depends on autoload order #889
Comments
Can you try changing (not sure if it will in this example thinking it through, but it has helped in some other cases of inconsistencies) |
Noting that it's class constants involved here which form part of the class definition, I'm thinking that for Xdebug this might relate to/be another example of https://bugs.xdebug.org/view.php?id=1798 which affects |
This has no effect on the underlying issue
That's likely a similar issue: the solution I proposed in #892 should also cover your #775 indeed |
With the merge of #892, IIRC, the todo list now is:
|
Agreed. Do you want to work on this, Filippo? Otherwise I'll try to work on this over the weekend. |
As soon as I'm able to code something, I'll open a PR on draft: if you don't see any it means I haven't started it yet so you can take that chance |
Cheers! |
The failing diff relates to: php-code-coverage/tests/_files/source_without_namespace.php Lines 12 to 18 in 6882cdb
And this: php-code-coverage/src/StaticAnalysis/IgnoredLinesFindingVisitor.php Lines 92 to 94 in 8c95e20
Blocks all visitors, including I'm trying some fixes |
Ah, of course. Did not think about the usage of |
Should be taken care of in 115a62b. |
With your pushes and #893 merged, I think this can be closed now. Once released, I guess other |
in
and test script:
and
(if file is ended with one or more NL, an extra/last line is reported)
but if I change the
if I change then (after the previous change) the
NOTICE THE COVERAGE IS UNSTABLE: sometimes I get if
but after a short time I get 5️⃣:
(which seems to be stable then, at least for several consequent runs) and I confirm the reported problem, when I move the
I get 6️⃣:
and next run I get 7️⃣:
@Slamdunk can you please return the test scripts (and post results 1️⃣ - 7️⃣ here) on your side linux/PHP 8.0 with xdebug and PCOV? Maybe some problems can be addressed in PHP/xdebug directly. |
You can easily get the result on your own with the PHP Docker images, so you can speed this process up. 1️⃣ string(1) "y"
Array
(
- [14] => 1
+ [11] => 1
[17] => 1
[18] => -1
[21] => 1
+ [22] => 1
) 2️⃣ string(1) "y"
Array
(
- [13] => 1
- [14] => 1
+ [11] => 1
[17] => 1
+ [18] => -1
[21] => 1
+ [22] => 1
) 3️⃣ string(2) "5u"
Array
(
- [14] => 1
+ [11] => 1
[17] => 1
[18] => -1
[21] => 1
+ [22] => 1
) 6️⃣ string(2) "5u"
Array
(
+ [7] => 1
[9] => 1
[10] => 1
[13] => 1
[14] => -1
[21] => 1
+ [22] => 1
) |
another "unstable" coverage output: #774 |
Hi, currently CodeCoverage depends on code execution order.
I created a self contained repo that shows this behavior in https://github.com/Slamdunk/phpunit_codecoverage_bug#readme
Basically, given the following code:
LOC
ifAType
was already loaded and parsed before theA
is used in the testAType
is unknown to PHP duringinArray
call, lines 6 and 7 are consideredLOC
.This messes CodeCoverage merging in context like ParaTest where test execution is isolated but not deterministic.
Merging two CC reports coming from different tests run in different processes can result in something like this:
Which doesn't make much sense
I don't know if this library can do much about this, maybe @krakjoe and @derickr could help
The text was updated successfully, but these errors were encountered: