I have my PHPUnit setup and coverage report working fine without a white list filter. Once I add one however, the report seems to only partially generate as if PHPUnit quit unexpectedly. I do not get any errors or warnings.

My configuratoon looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="./bootstrap.php"
         colors="true">
    <testsuites>
        <testsuite name="...">
            <testsuite name="...">
                <directory>./path/to/suite</directory>
            </testsuite>
            <testsuite name="...">
                <directory>./path/to/suite2</directory>
            </testsuite>
            <testsuite name="...">
                <directory>./path/to/suite3</directory>
            </testsuite>
        </testsuite>
    </testsuites>

    <filter>
        <whitelist>
            <directory suffix=".php">../path/to/files</directory>
        </whitelist>
    </filter>

    <logging>
        <log type="coverage-html" target="log/" charset="UTF-8" yui="true" />
    </logging>
</phpunit>

Any idea on what could be going wrong?

share|improve this question

2 Answers

Sorry for digging up an old one but I googled for phpunit code coverage not working and this one showed up.

I let code coverage just run it's course (think xdebug is used for it) and it was fine for a while.

Then when I created a new test it suddenly stopped working, code that ran was marked as not covered.

The test classes I created with phpunit: phpunit-skelgen --test

That one creates coverage annotations like: @covers MyClass::someMethod

Removing them solved it for me, xdebug now was used again and suddenly had 100% coverage.

One remark on coverage; Just calling a method once covers it in the report but mostly cannot be considered as covered. Calling it with null values and invalid values covers it.

share|improve this answer
Thank you for sharing – Ninsuo Sep 21 '12 at 21:29
up vote 1 down vote accepted

Turns out there was some script halting procedural code in the files I was white listing.

share|improve this answer
yes, a hard DIE() or EXIT; in php code will stop PHPunit coverage reports. – Alex C Jan 27 '11 at 16:27

Your Answer

 
or
required, but never shown
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.