对于类似问题Laravel 5有一个答案:PHPUnit并没有可用的代码覆盖驱动程序,但我安装了xdebug.
(如果我正在使用这个问题:windows7,netbeans8.1,php7,wamp3)
在Netbeans中显示代码覆盖率会导致:
错误:没有可用的代码覆盖率驱动程序
,输出如下:
"C:\ wamp\www\treningPHPUnitSymfony2.8\bin\phpunit.bat"" - colors"" - log-junit""C:\ Users\chiny\AppData\Local\Temp \nb-phpunit-log. xml""--coverage-clover""C:\ Users\chiny\AppData\Local\Temp \nb-phpunit-coverage.xml""C:\ Program Files\NetBeans 8.1\php\phpunit\NetBeansSuite.php"" - ""--run = C:\ wamp\www\treningPHPUnitSymfony2.8\src\TreningBundle\Tests\Controller\RabarbarControllerTest.php"由Sebastian Bergmann和贡献者提供的PHPUnit 5.3.4.
错误:没有可用的代码覆盖率驱动程序
.II 3/3(100%)
时间:1.13秒,内存:4.00MB
好的,但不完整,跳过或有风险的测试!测试:3,断言:1,不完整:2.完成.](网址)
xdebug 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
Run Code Online (Sandbox Code Playgroud)
(我在同一个Windows分区中有netbeans和项目目录)
Rig*_*lly 23
php.ini
在大多数Apache/PHP安装中有2个文件,肯定在WAMPServer中
要修改php.ini
PHP在Apache中使用的正确使用菜单
wampmanager->PHP->php.ini
Run Code Online (Sandbox Code Playgroud)
但是对于php.ini
PHP CLI使用的文件,您必须手动编辑
\wamp\bin\php\php{version}\php.ini
Run Code Online (Sandbox Code Playgroud)
php -v
如果在CLI中配置了XDEBUG,则a的结果应如下所示
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
Run Code Online (Sandbox Code Playgroud)
注意
目前的WAMPServer 3是3.0.4
ADDON升级可以在SourceForge上找到
最新的ADDON PHP版本是PHP7.0.6,也可以在SourceForge上使用
请参阅WampServer论坛,了解WAMPServer 3最新版本的PHP/MYSQL/Apache ADDONS
另外:
您可能会发现,你必须tweek的Xdebug的配置参数中php.ini
,以满足您的特定需求
我在使用PHP 7.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>
Run Code Online (Sandbox Code Playgroud)
此解决方案仅适用于MacOS,如果您想在Linux上运行,那么您需要使用适用的包管理器,如apt-get等.
归档时间: |
|
查看次数: |
37680 次 |
最近记录: |