View Issue Details

IDProjectCategoryView StatusLast Update
0001224Xdebug(No Category)public2016-02-11 18:40
ReportersamsonasikAssigned Toderick 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionno change required 
PlatformOSMac OSOS Version10.11
Product Version2.4.0rc2 
Target VersionFixed in Version 
Summary0001224: phpunit coverage with php7 and 2.4.0RC3-dev coverage always 100%
Descriptionit 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- install php7.0.0
- install xdebug 2.4.0RC3-dev
TagsNo tags attached.
Operating System
PHP Version7.0-dev

Activities

samsonasik

2015-12-09 23:50

reporter   ~0003309

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.

derick

2015-12-10 14:53

administrator   ~0003311

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)?

samsonasik

2015-12-11 15:51

reporter  

rep.png (15,437 bytes)
rep.png (15,437 bytes)

samsonasik

2015-12-11 15:51

reporter  

green.png (5,594 bytes)
green.png (5,594 bytes)

samsonasik

2015-12-11 15:52

reporter   ~0003319

Last edited: 2015-12-11 15:53

View 2 revisions

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.

derick

2015-12-11 16:48

administrator   ~0003320

Sorry - but I really need a reproducible case. I can't guess what's wrong from this description.

samsonasik

2015-12-11 18:42

reporter   ~0003323

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

samsonasik

2015-12-16 17:20

reporter   ~0003356

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.

ramsey

2016-01-03 23:59

reporter   ~0003381

Last edited: 2016-01-04 00:00

View 2 revisions

I'm experiencing the same issue with PHP 7.0.0 and Xdebug v2.4.0RC3. Here are the steps to reproduce:

git clone https://github.com/ramsey/uuid-doctrine.git
cd uuid-doctrine/
composer install
./vendor/bin/phpunit --verbose --coverage-html build/coverage
open build/coverage/index.html


Click on UuidBinaryType.php and look at around lines 50-52, which should look like this:

return $platform->getBlobTypeDeclarationSQL([
    'length' => '16',
]);


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.

derick

2016-02-08 19:43

administrator   ~0003447

Ramsey, the cloned code doesn't match your comments. Line 50-52 are:

50
51 /**
52 * {@inheritdoc}

And the lines with length 16 are now:

41 public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
42 {
43 return $platform->getBinaryTypeDeclarationSQL(
44 array(
45 'length' => '16',
46 'fixed' => true,
47 )
48 );
49 }

Line 43 and 45 show as covered.

Can you check again?

derick

2016-02-08 19:45

administrator   ~0003448

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?

ramsey

2016-02-08 20:27

reporter   ~0003450

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
cd uuid-doctrine/
git checkout abbcbe56b023319dea7a72177333089cf47f5a69
composer install
./vendor/bin/phpunit --verbose --coverage-html build/coverage
open build/coverage/index.html

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.

samsonasik

2016-02-09 00:33

reporter   ~0003466

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.

derick

2016-02-11 18:40

administrator   ~0003481

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>
  '/tmp/uuid-doctrine/src/UuidBinaryType.php' =>
  array(6) {
    [43] =>
    int(1)
    [44] =>
    int(1)
    [45] =>
    int(1)
    [50] =>
    int(-1)
    [51] =>
    int(-1)
    [53] =>
    int(-2)
  }
</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.

Issue History

Date Modified Username Field Change
2015-12-07 08:04 samsonasik New Issue
2015-12-09 23:50 samsonasik Note Added: 0003309
2015-12-10 14:53 derick Note Added: 0003311
2015-12-10 14:53 derick Assigned To => derick
2015-12-10 14:53 derick Status new => feedback
2015-12-10 14:53 derick Product Version 2.4.0beta1 => 2.4.0rc2
2015-12-11 15:51 samsonasik File Added: rep.png
2015-12-11 15:51 samsonasik File Added: green.png
2015-12-11 15:52 samsonasik Note Added: 0003319
2015-12-11 15:52 samsonasik Status feedback => assigned
2015-12-11 15:53 samsonasik Note Edited: 0003319 View Revisions
2015-12-11 16:48 derick Note Added: 0003320
2015-12-11 16:48 derick Status assigned => feedback
2015-12-11 18:42 samsonasik Note Added: 0003323
2015-12-11 18:42 samsonasik Status feedback => assigned
2015-12-16 17:20 samsonasik Note Added: 0003356
2016-01-03 23:59 ramsey Note Added: 0003381
2016-01-04 00:00 ramsey Note Edited: 0003381 View Revisions
2016-02-08 19:43 derick Note Added: 0003447
2016-02-08 19:45 derick Note Added: 0003448
2016-02-08 20:27 ramsey Note Added: 0003450
2016-02-09 00:33 samsonasik Note Added: 0003466
2016-02-11 18:40 derick Note Added: 0003481
2016-02-11 18:40 derick Status assigned => resolved
2016-02-11 18:40 derick Resolution open => no change required
2016-07-31 12:35 derick Category Debug client (console) => debugclient (debugging tool)
2016-07-31 12:35 derick Category debugclient (debugging tool) => (No Category)