PHP Unit 5.5.x / 4.8.x Code-Coverage not working

Hello together,

I established some problems while trying to use code coverage in PHPStorm 2016.02.

The tests got executed, coverage-files are created, CodeCoverage-Data window shows up.. but then there is no coverage shown (0%) and no lines getting colored...

 

OS: OS X El Capitan 10.11.6

PHP Version: 7.0.8

XDebug: 2.4.0

PHP Unit: 5.5.5 / 4.8  

 

phpunit.xml:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit>
<filter>
<whitelist>
<directory suffix=".php">src</directory>
</whitelist>
</filter>
</phpunit>

PHPUnit Output:

/usr/local/opt/php70/bin/php -dxdebug.coverage_enable=1 /Applications/XAMPP/htdocs/projekte/deltatecc-intern/ArticleCategoryMapper/vendor/phpunit/phpunit/phpunit --coverage-clover /Users/deltatecc/Library/Caches/PhpStorm2016.2/coverage/ArticleCategoryMapper$ArticleCategoryMapperTest_testGetCategory.coverage --configuration /Applications/XAMPP/htdocs/projekte/deltatecc-intern/ArticleCategoryMapper/phpunit.xml --filter "/::testGetCategory( .*)?$/" deltatecc\ArticleCategoryMapper\ArticleCategoryMapperTest /Applications/XAMPP/htdocs/projekte/deltatecc-intern/ArticleCategoryMapper/tests/src/ArticleCategoryMapperTest.php --teamcity
Testing started at 15:37 ...
PHPUnit 5.5.5 by Sebastian Bergmann and contributors.

 

Time: 238 ms, Memory: 4.00MB

OK (1 test, 1 assertion)

Generating code coverage report in Clover XML format ... done

Process finished with exit code 0

 

 

*.coverage File:

<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1475069842">
<project timestamp="1475069842">
<package name="deltatecc\ArticleCategoryMapper">
<file name="/Applications/XAMPP/xamppfiles/htdocs/projekte/deltatecc-intern/ArticleCategoryMapper/src/ArticleCategoryMapper.php">
<class name="ArticleCategoryMapper" namespace="deltatecc\ArticleCategoryMapper">
<metrics complexity="2" methods="1" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="4" coveredstatements="3" elements="5" coveredelements="3"/>
</class>
<line num="14" type="method" name="getCategory" visibility="public" complexity="2" crap="2.06" count="1"/>
<line num="16" type="stmt" count="1"/>
<line num="17" type="stmt" count="1"/>
<line num="18" type="stmt" count="0"/>
<line num="21" type="stmt" count="1"/>
<metrics loc="23" ncloc="17" classes="1" methods="1" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="4" coveredstatements="3" elements="5" coveredelements="3"/>
</file>
</package>
<metrics files="1" loc="23" ncloc="17" classes="1" methods="1" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="4" coveredstatements="3" elements="5" coveredelements="3"/>
</project>
</coverage>





Kind regards,

Niels Veith

4 comments
Comment actions Permalink

Hello,

Does it work fine if you run PHPUnit with coverage from the command line?

Can you see any error messages in the log file (Help > Show Log in Finder > idea.log) after reproducing the issue?

0
Comment actions Permalink

Hey Vladimir,

no errors in the log, works fine when running from cli, the plugin "PHPUnit code coverage" from the repos also works fine, but this is only for highlighting rows.. I wanted to use the jetbrains implementation...

 

 

0
Comment actions Permalink

It works now.

In my projectsetup was somewhere the wrong user directory (from an previsous os x installation) registerd.

After recreating the config everything works fine.

 

 

 

0
Comment actions Permalink

Thanks for the update. Glad that this has been sorted out!

0

Please sign in to leave a comment.