I use PHP 7.4.13, PhpStorm 2020.1.4, PHPUnit 9.5.8.
I try to use PHPUnit code coverage tool with PCOV, but I don't get it to work.
I installed pcov:
pecl install pcov
I enabled the extension in the php.ini file:
extension="pcov.so"
My phpunit.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
<testsuite name="Integration">
<directory suffix="Test.php">./tests/Integration</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./app</directory>
</whitelist>
</filter>
<php>
<server name="APP_ENV" value="testing"/>
<server name="BCRYPT_ROUNDS" value="4"/>
<server name="CACHE_DRIVER" value="array"/>
<server name="MAIL_DRIVER" value="array"/>
<server name="QUEUE_CONNECTION" value="sync"/>
<server name="SESSION_DRIVER" value="array"/>
<server name="DB_DATABASE" value="testing"/>
</php>
</phpunit>
When I try to run phpunit --coverage-html coverage
I get the following:
I think the problem is the missing coverage driver. But where does the problem come from and how can I fix it?
I'm trying to solve this problem since 3 hours now, but I cant find a way.
I hope someone can help :)