Just to increment the last answer. Usually, it happens because PHPunit see all the files and you need to tell them to not do it, like this follow example:
Take a look to my filter node into phpunit.xml like this
<filter>
<whitelist>
<directory>../src</directory>
</whitelist>
</filter>
I need to add addUncoveredFilesFromWhitelist equal to false and add all of the files which I need to exclude, like this:
<filter>
<whitelist addUncoveredFilesFromWhitelist="false">
<directory suffix=".php">../src</directory>
<exclude>
<directory>../vendor</directory>
<directory>../anotherpath</directory>
<directory>../src/Modules/*/Fixture</directory>
<file>../src/Modules/*/Bootstrap.php</file>
</exclude>
</whitelist>
</filter>
Pay attention to my exclude list where I exclude the "Fixture" directory and Bootstrap.php file for all modules
After did this simple changes my unit tests change from 10 minutes to 3 minutes, so enjoy :)
xdebug_start_code_coverage()
function is called with theXDEBUG_CC_DEAD_CODE
andXDEBUG_CC_UNUSED
options, and "Enabling those options make code coverage drastically slower." – Rinker