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%...

3
  • @craig_h Yes I'm sure, I get the test reporting with all passed tests (I also could debug into them) Commented Oct 15, 2015 at 11:11
  • @craig_h I have "Show options" checked and "Activate Coverage View" checked Commented Oct 15, 2015 at 12:54
  • @craig_h adding /**@test**/ doesn't change anything Commented Oct 17, 2015 at 16:03

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.