Home » Php » php – PHPUnit whitelist code coverage

php – PHPUnit whitelist code coverage

Posted by: admin July 12, 2020 Leave a comment


The whitelist isn’t working how I would expect when get code coverage reports. I am using Zend Framework and my Zend files are also in the library directory just like the project quickstart.

I’m running PHPUnit 3.6 from Netbeans 7.0.1

I only really want to see the coverage for the classes for MyLib.

    <directory suffix=".php">../../library/MyLib</directory>

But in the report I seem to get a percentage value for several Zend files eg. Zend_Controller_Front, Zend_Loader_Autoloader etc.

Obviously I haven’t written any tests for these classes and it is no surprise that I have 0% coverage.

What have I missed?

How to&Answers:

Please use absolute paths in your XML file and/or ensure those are correctly resolved by your phpunit test-runner call. Also ensure that your XML file is loaded.