【问题标题】:PHPUnit Integration into NetBeans 7PHPUnit 集成到 NetBeans 7
【发布时间】:2011-11-28 08:19:04
【问题描述】:

我正在尝试让 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>

如何解决这个错误?

【问题讨论】:

  • 我假设它在调用 phpunit 时通过,检查 get 执行的命令,看看是否有一些配置可以影响。

标签: netbeans phpunit


【解决方案1】:

为了强制 PHPUnit 使用正确的文件,我必须右键单击项目名称、设置配置、自定义、PHPUnit,然后隐式指定引导程序和 XML 配置文件的位置。

【讨论】:

    【解决方案2】:

    我在使用 XAMPP、PHPUnit 3.5 和 NetBeans 7 时遇到了类似的问题。问题是,NetBeans 出于某种原因总是将选项“--log-xml”传递给 phpunit.bat,但 PHPUnit 中不存在此选项3.5 了。

    我的解决方案是编辑 PHPUnit 配置 XML 文件: C:\xampp\php\PEAR\tests\MIME_Type\tests\phpunit.xml

    (请注意,文件路径取决于您的 PEAR 或 PHPUnit 安装所在的路径!)

    我必须附加一个新节点,“日志记录”:

    <?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 现在再次验证。 :-)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-11-16
      • 2010-12-05
      • 2011-08-07
      • 1970-01-01
      • 2013-07-18
      • 2012-03-01
      • 1970-01-01
      • 2014-11-05
      相关资源
      最近更新 更多