Clover PHPUnit coverage report is including coverage for unwanted file Clover PHPUnit coverage report is including coverage for unwanted file jenkins jenkins

Clover PHPUnit coverage report is including coverage for unwanted file


After some googling I found that the answer is to create a configuration file for phpunit, where you can exclude specific files or directories from the code coverage report.

"The < filter > element and its children can be used to configure the blacklist and whitelist for the code coverage reporting."

<filter>  <blacklist>    <directory suffix=".php">/path/to/files</directory>    <file>/path/to/file</file>    <exclude>      <directory suffix=".php">/path/to/files</directory>      <file>/path/to/file</file>    </exclude>      </blacklist>  <whitelist addUncoveredFilesFromWhitelist="true">    <directory suffix=".php">/path/to/files</directory>    <file>/path/to/file</file>    <exclude>      <directory suffix=".php">/path/to/files</directory>      <file>/path/to/file</file>    </exclude>  </whitelist></filter>

Then call PHPUnit using the flag:

phpunit -c config.xml

More information on the configuration file can be found here:

http://www.phpunit.de/manual/current/en/appendixes.configuration.html