对于类似的问题Laravel 5: PHPUnit,没有代码覆盖驱动程序有一个答案,但我已经安装了xdebug。
(如果我使用的是: windows7,netbeans8.1,php7,wamp3)
在Netbeans中显示代码覆盖率将导致:
错误:没有可用的代码覆盖驱动程序
,产出如下:
"C:\wamp\www\treningPHPUnitSymfony2.8\bin\phpunit.bat“-颜色”书名/作者-run=C:\wamp\www\treningPHPUnitSymfony2.8\src\TreningBundle\Tests\Controller\RabarbarControllerTest.php“PHPUnit . 错误:没有可用的代码覆盖驱动程序 .II 3/3 (100%) 时间: 1.13秒,内存: 4.00MB 好的,但是不完整,跳过,或者有风险的测试!测试: 3,断言: 1,不完整: 2.完成。](Url)
X调试conf (C:\wamp\bin\apache\apache2.4.17\bin\php.ini):
[xdebug]
zend_extension ="C:/wamp/bin/php/php7.0.1/zend_ext/php_xdebug-2.4.0rc3-7.0-vc14.dll"
xdebug.remote_enable = off
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = Off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir ="C:/wamp/tmp"
xdebug.show_local_vars=0加载扩展

(我在同一个Windows分区中有netbeans和项目目录)
发布于 2016-05-17 09:10:23
大多数Apache/ php.ini安装中都有两个WAMPServer文件,而且肯定是在WAMPServer中。
要修改Apache中PHP使用的正确的php.ini,请使用菜单
wampmanager->PHP->php.ini但是对于PHP使用的php.ini文件,您必须手动编辑
\wamp\bin\php\php{version}\php.ini如果在CLI中配置了XDEBUG,则php -v的结果应该如下所示
php -v
PHP 7.0.6 (cli) (built: Apr 27 2016 14:00:40) ( ZTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans注意事项
当前的WAMPServer 3是3.0.4插件升级,可以在SourceForge上找到。
最新的ADDON版本是PHP7.0.6,也可以在SourceForge上获得
请参阅WampServer论坛以跟上WAMPServer 3的最新版本: PHP / MYSQL / Apache加载项
此外:
您可能会发现,您必须在设置XDEBUG配置参数中使用php.ini来满足您的特定需求。
发布于 2017-03-16 22:12:20
我在PHP7.1的新安装中遇到了这个问题,这就是我为使它工作所做的
$ brew install php71-xdebug
$ php -i | grep xdebug //检查是否安装了xdebug
$ phpunit
在那之后它起作用了。此外,这也是我的phpunit.xml看起来需要白名单的整个结构,因为它是共享组件
<?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"
syntaxCheck="false">
<testsuites>
<testsuite name="Tests">
<directory suffix=".php">./Tests/</directory>
</testsuite>
</testsuites>
<logging>
<log type="coverage-clover" target="./build/logs/clover.xml"/>
</logging>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory>./</directory>
</whitelist>
</filter>
</phpunit>这个解决方案只适用于MacOS,如果您想让它在Linux上工作,那么您需要使用适用的包管理器,比如apt-get等等。
发布于 2020-08-03 08:20:22
在Debian上也有同样的问题:
错误:没有可用的代码覆盖驱动程序
我通过安装php-xdebug:sudo apt install php-xdebug修复了它。
https://stackoverflow.com/questions/37270837
复制相似问题