我正在尝试让PHPUnit在Netbeans中工作。我使用的是3.4.9,但它拒绝工作,它被建议升级到最新版本。我现在已经升级到3.5.15,当我运行它时,我得到以下消息:
unrecognized option --log-xml我知道这不是一个有效的日志记录选项,但是我不知道在哪里设置它,或者如何更改它。我的phpunit.xml文件是:
<phpunit bootstrap="./application/bootstrap.php" colors="true">
<testsuite name="Personal Development">
<directory>./</directory>
</testsuite>
<filter>
<whitelist>
<directory suffix=".php">../application/</directory>
<exclude>
<file>../application/Bootstrap.php</file>
<file>../application/controllers/ErrorController.php</file>
<directory suffix=".phtml">../application/</directory>
</exclude>
</whitelist>
</filter>
<logging>
<log type="coverage-html" target="./log/report" charset="UTF-8"
yui="true" highlight="true" lowUpperBound="50" highLowerBound="80"/>
<log type="testdox-html" target="./log/testdox.html" />
</logging>
</phpunit>如何修复此错误?
发布于 2011-09-30 19:01:53
为了强制PHPUnit使用正确的文件,我必须右键单击项目名称,设置Configuration,Customize,PHPUnit,然后隐式地指定bootstrap和XML Config文件的位置。
发布于 2011-10-11 21:43:22
我在使用XAMPP、PHPUnit 3.5和NetBeans 7时遇到了类似的问题。问题是,由于某种原因,NetBeans总是将“-- PHPUnit -xml”选项传递给phpunit.bat,但这个选项在PHPUnit 3.5中已经不存在了。
我的解决方案是编辑PHPUnit配置XML文件: C:\xampp\php\PEAR\tests\MIME_Type\tests\phpunit.xml
(请注意,文件路径取决于PEAR或PHPUnit安装所在的路径!)
我不得不添加一个新节点"logging":
<?xml version="1.0" encoding="utf-8"?>
<phpunit strict="true" colors="true"
bootstrap="bootstrap.php"
>
<filter>
<whitelist>
<directory suffix=".php">../MIME/</directory>
</whitelist>
</filter>
<logging>
<log type="junit" target="c:/xampp/tmp/logfile.xml" logIncompleteSkipped="false"/>
</logging>
</phpunit>在此更改之后,NetBeans不再传递"--log-xml“选项,而是传递"--log-junit”选项,这对PHPUnit 3.5有效。MyTests现在再次验证。:-)
https://stackoverflow.com/questions/7608615
复制相似问题