4

I'm using Codeigniter3 framework and a phpunit package ci-phpunit-test. I run php on zend server with zend debugger enabled.

My phpunit.xml file is there :

<phpunit
    bootstrap="./Bootstrap.php"
    colors="true"
    testsuite="CodeIgniter Application Test Suite">
    <testsuites>
        <testsuite name="CodeIgniter Application Test Suite">
            <directory suffix="test.php">./</directory>
            <exclude>./_ci_phpunit_test/</exclude>
        </testsuite>
    </testsuites>
    <filter>
        <whitelist>
            <directory suffix=".php">../controllers</directory>
            <directory suffix=".php">../models</directory>
        </whitelist>
    </filter>
</phpunit>

I run the code coverage execution using the icon with a green play and dashes, this runs the following command :

"C:\Program Files (x86)\Zend\ZendServer\bin\php.exe" -dzend_debugger.enable_coverage=1 C:/Users/NICOLAS/AppData/Local/Temp/ide-phpunit.php --configuration C:\....\phpunit.xml

After running successfully all the tests, the Coverage PHPUnit side bar opens and only shows 0% coverage (I'm sure the tests go through a lot of code).

Here is what I get :

enter image description here

UPDATE : some more information... When I add this in the phpunit.xml file, it tells me Xdebug is not enabled:

<logging>
    <log type="coverage-html" target="build/coverage"/>
    <log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false"/>
</logging>

Therefore I tried enabling the xdebug debugger, the tests were veeeeeery slow to run and I got a HTML report in build/coverage folder. It's good but not integrated in PHPStorm environment.

So I went back to zend debugger and try the PHPStorm feature (removing the log section in phpunit.xml). Tests are quick to run but coverage stays at 0%...

Nicolas Thery
  • 2,319
  • 4
  • 26
  • 36

1 Answers1

1

i had the same problem and this answer did the trick.

By changing the project root to the absolute path (/media/hdd/...) I was able to resolve the problem.

Community
  • 1
  • 1
Senhorzim
  • 101
  • 3
  • I had the same issue and it worked for me. I had opened the project following a path containing a symlink, so there was a symlink in my project root. When I opened the project with the resolved symlink the code coverage worked. – Pitt Jan 19 '17 at 22:42