I have a problem that I could not find the solution on Google. When I run my unit tests with PHPUnit and Xdebug, I would like to do a code coverage.
However, when I do that, I get this error:
PHPUnit\Framework\Exception: Fatal error: Uncaught SebastianBergmann\CodeCoverage\NoCodeCoverageDriverAvailableException: No code coverage driver available in /Users/theobenoit/Desktop/Antipode.nosync/Sites/wp-framework-core/vendor/phpunit/php-code-coverage/src/Driver/Selector.php:53
├ Stack trace:
├ #0 Standard input code(43): SebastianBergmann\CodeCoverage\Driver\Selector->forLineCoverage(Object(SebastianBergmann\CodeCoverage\Filter))
├ #1 Standard input code(123): __phpunit_run_isolated_test()
├ #2 {main}
├ thrown in /Users/theobenoit/Desktop/Antipode.nosync/Sites/wp-framework-core/vendor/phpunit/php-code-coverage/src/Driver/Selector.php on line 53
I realized that this is because in some of my tests there is this at the top:
/**
* @runTestsInSeparateProcesses
* @preserveGlobalState disabled
*/
When I remove @runTestsInSeparateProcesses everything works fine, but there are problems because I mock functions.
If anyone has ever had this problem.