View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0001224 | Xdebug | public | 2015-12-07 08:04 | 2016-02-11 18:40 | |
| Reporter | samsonasik | Assigned To | |||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | resolved | Resolution | no change required | ||
| OS | Mac OS | OS Version | 10.11 | ||
| Product Version | 2.4.0rc2 | ||||
| Summary | 0001224: phpunit coverage with php7 and 2.4.0RC3-dev coverage always 100% | ||||
| Description | it happen only in php7 with xdebug 2.4.0RC3-dev, when I run phunit, the oncovered functions/untested function marked as covered/green. | ||||
| Steps To Reproduce |
| ||||
| Tags | No tags attached. | ||||
| Operating System | |||||
| PHP Version | 7.0-dev | ||||
|
|
I tested in phpunit 4 and phpunit 5, the coverage always 100% even only "__construct" tested. Other methods marked as green in bar, but blank white in code line. |
|
|
I don't know how to reproduce this... can you give detailed and complete instructions so that I can run it at home (without having to setup anything)? |
|
|
seems I can't reproduce in sample source now, but in real app, it looks something like this ( please see attached image) in php7, white in source and green in bar, while in php 5.6, it red. Thanks. |
|
|
Sorry - but I really need a reproducible case. I can't guess what's wrong from this description. |
|
|
I dug more on this, found that @runInSeparateProcess make it works, but wondering why it needed while in php 5.6, it works without @runInSeparateProcess |
|
|
I've gotten reproduce-able case for it, I tried mock SplFileObject in one of my test: $this->getMock(\SplFileObject::class, [], ['php://memory']); Interestingly, this issue is only happen in php7. It may related with phpunit itself. |
|
|
I'm experiencing the same issue with PHP 7.0.0 and Xdebug v2.4.0RC3. Here are the steps to reproduce:
Click on UuidBinaryType.php and look at around lines 50-52, which should look like this:
These lines are not covered by the tests, but there is no indication in the code coverage report that they aren't covered, and the report shows 100% of the lines covered. I expect to see these lines displayed in red in the report, and I expect the percentage covered to be less than 100%. When I run these same commands in PHP 5.6.16 with Xdebug v2.4.0RC3, then I see these same lines colored in red, and the file shows 88.46% of the lines covered. |
|
|
Ramsey, the cloned code doesn't match your comments. Line 50-52 are: 50 And the lines with length 16 are now: 41 public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) Line 43 and 45 show as covered. Can you check again? |
|
|
Samsoniak, a reproducible case is something I can download and run. If it's just a one liner, it's not going to be useful to me. What Ramsey did is. Can you do something similar? |
|
|
Sorry about that, Derick. I've made changes to the library, so my bug report is now out of date. To get to the exact same reproducible state I mentioned above, use commit abbcbe56b023319dea7a72177333089cf47f5a69. Steps: git clone https://github.com/ramsey/uuid-doctrine.git Now, look at lines 50-52 on UuidBinaryType.php. I expect these to be in red, as they were not covered. Instead, they are neither green nor red, and the coverage report shows 100% coverage. |
|
|
I'm sorry derick, I can't give reproduceable case that can be shown publicly for now... hopefully what ramsey did above is same with my case. Thank you. |
|
|
This does not seem to be a bug in Xdebug. When debugging Ramsey's code, and outputting (by modifying phpunit's code) the result of each xdebug_get_code_coverage(), there is in the output: <code> Which is the right result. For some reason, phpunit code coverage simply chooses not to show the information. samsonasik, I obviously can't debug your code, but let's assume it's the same issue. |