PHPUnit Code coverage targets testing class, not tested class

Hello,

I have a problem generating and obtaining code coverage. My code coverage covers not tested class, but class that actually tests (so AxaAnnextTest.php class). May I misconfigured something?

I can see coverage on testing class, not tested class.

0
5 comments

Probably you've defined the whitelist wrongly at phpunit.xml. Can we take a look at it?

0
Avatar
Permanently deleted user

Here it is:

<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./</directory>
</whitelist>
</filter>
0

Try to add a --whitelist <target_class_name> (e.g. --whitelist AxaAnnex) option to a test runner in your PhpUnit run configuration.

0
Avatar
Permanently deleted user

Test still covers testing class, not tested class. Those are my files:

 

I've got an test folder with testing class.

On the same level of tree, I've got "src" folder with domains inside. I test everything from /src/Domain/Insurance folder.

0
Avatar
Permanently deleted user

This configuration finally worked:

 

<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">../src/</directory>
</whitelist>
</filter>

<logging>
<log type="coverage-html" target="../public/build/coverage/" title="api - testy"
charset="UTF-8" yui="true" highlight="true"
lowUpperBound="35" highLowerBound="70"/>
<log type="coverage-clover" target="../public/build/logs/clover.xml"/>
<log type="junit" target="../public/build/logs/junit.xml" logIncompleteSkipped="false"/>
</logging>
0

Please sign in to leave a comment.