This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 268976

Summary: Code coverage collection does not work
Product: php Reporter: Vitex
Component: PHPUnitAssignee: Tomas Mysik <tmysik>
Status: VERIFIED FIXED    
Severity: normal    
Priority: P3    
Version: 8.2   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: code coverage report in Clover XML

Description Vitex 2016-11-14 15:38:01 UTC
Created attachment 162909 [details]
code coverage report in Clover XML

IDE Log:

INFO [org.netbeans.modules.php.phpunit.coverage.CoverageProvider]: File /tmp/nb-phpunit-coverage.xml not found. If there are no errors in PHPUnit output (verify in Output window), please report an issue (http://www.netbeans.org/issues/).

but file exists:

ls -la /tmp/nb-phpunit-coverage.xml
-rw-r--r-- 1 vitex vitex 5868 lis 14 15:34 /tmp/nb-phpunit-coverage.xml

Generated command is OK:

"/usr/bin/php" "/home/vitex/Projects/AdminIT/FlexiCenik/vendor/bin/phpunit" "--colors" "--log-json" "/tmp/nb-phpunit-log.json" "--bootstrap" "/home/vitex/Projects/AdminIT/FlexiCenik/testing/bootstrap.php" "--configuration" "/home/vitex/Projects/AdminIT/FlexiCenik/testing/configuration.xml" "--coverage-clover" "/tmp/nb-phpunit-coverage.xml" "/usr/local/netbeans-8.2/php/phpunit/NetBeansSuite.php" "--" "--run=/home/vitex/Projects/AdminIT/FlexiCenik/testing/src/FlexiCenik/FlexiCenikTest.php"
PHPUnit 5.5.7 by Sebastian Bergmann and contributors.

Runtime:       PHP 5.6.27-0+deb8u1 with Xdebug 2.2.5
Configuration: /home/vitex/Projects/AdminIT/FlexiCenik/testing/configuration.xml

..IIIIIIIIIIIIII....IIIIIIIIIIIIII......II.I..................... 65 / 79 ( 82%)
..............                                                    79 / 79 (100%)

Time: 351 ms, Memory: 9.75MB

There were 31 incomplete tests: 
.
.
.
.
31) Test\FlexiCenik\FlexiCenikTest::testSearchColumns
This test has not been implemented yet.

/home/vitex/Projects/AdminIT/FlexiCenik/vendor/vitexsoftware/ease-framework/tests/src/Ease/BrickTest.php:387

OK, but incomplete, skipped, or risky tests!
Tests: 79, Assertions: 64, Incomplete: 31.

Generating code coverage report in Clover XML format ... done
Done.
Comment 1 Tomas Mysik 2016-11-15 06:32:31 UTC
It works fine with PHPUnit 4.x but fails with PHPUnit 5.x. Thanks for catching that, I will try to fix it.

Thanks for reporting.
Comment 2 Tomas Mysik 2016-11-15 06:37:33 UTC
Aha, in my case, the PHPUnit 5.x says:

Error: No whitelist configured, no code coverage will be generated

Will investigate it.
Comment 3 Tomas Mysik 2016-11-15 07:04:14 UTC
So, PHPUnit 5.x requires whitelisting for code coverage [1]. I will add a CLI parameter for it (I tested it with older versions of PHPUnit 4.7 and 3.7 and it should not break anything).

Thanks.
[1] https://phpunit.de/manual/current/en/code-coverage-analysis.html
Comment 4 Tomas Mysik 2016-11-15 07:25:32 UTC
(In reply to Tomas Mysik from comment #3)
> I tested it with older versions of PHPUnit 4.7 and 3.7 and it should not break anything.

My bad, older versions complain about this parameter so it cannot be easily added.

Lowering to P3 because it seems to me that the only thing NetBeans can do is to inform user that the coverage log was not found (user needs to set whitelist in her XML configuration).

However, it does not seem to fix your original report - you apparently have whitelist defined in your XML configuration, right? However, I cannot reproduce it; could you please try to create a sample project and attach it here?

Thanks.
Comment 5 Tomas Mysik 2016-11-15 08:02:40 UTC
Info message added. As I wrote, this will not help in your case but since I cannot reproduce it, I cannot do much, sorry :/

Thanks.

http://hg.netbeans.org/web-main/rev/b27d497872f5
Comment 6 Tomas Mysik 2016-11-15 08:14:17 UTC
I just verified that the message appears.
Comment 7 Quality Engineering 2016-11-16 02:51:21 UTC
Integrated into 'main-silver', will be available in build *201611160001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/b27d497872f5
User: Tomas Mysik <tmysik@netbeans.org>
Log: #268976 - Code coverage collection does not work
Comment 8 Tomas Mysik 2016-12-03 14:06:29 UTC
Transplanted to the releases repo branch release82:

http://hg.netbeans.org/releases/rev/9c7b467c6fe3

Thanks.