First, let me say that I went through Achieving 100% code coverage with PHPUnit SO , and How to get 100% code coverage with PHPUnit SO . I also could not solve the problem using.
My problem is that PHPUnit reports different coverage of the% code for the same test when it is executed in isolation compared to when the entire test package is launched. So when I run only a specific test using phpunit test/src/artax/UsesRequestTraitTest , I get the following coverage:

However, if I run the full test suite using phpunit without specifying a specific test, I get the following for the same file:

Here is the source code for the test:
<?php class UsesRequestTraitTest extends PHPUnit_Framework_TestCase { public function testIsInitiallyEmpty() { $traitObj = $this->getObjectForTrait('artax\UsesRequestTrait'); $this->assertAttributeEmpty('request', $traitObj); return $traitObj; } public function testSetterAssignsRequestProperty($traitObj) { $r = new artax\blocks\http\HttpRequest(); $traitObj->setRequest($r); $this->assertEquals($r, $traitObj->getRequest()); } }
If you notice, you will see that I am testing the PHP5.4 trait. I am using PHP5.4RC6 and version 2.5 xdebug for the bleeding edge version because the version of xdebug does not yet support PHP5.4.
Is it possible (probably?) That this is an error in xdebug or phpunit that has not yet been developed due to the still developing support for the new version of PHP, but I wanted to get other opinions before wasting interested parties time with an unnecessary error message. Does anyone know what might cause this or how to fix it, so my Geek OCD is not driving me crazy about this gap in 100% coverage?
PS Has an actual graphical coverage report for a coverage version of 60%. The lines shown below are green (covered) when the test is executed in isolation:

UPDATE
I also tried adding @covers annotations for the trait methods to tests of specific classes that use attribute, but this did not help either ...
source share