PHPUnit、PHPUnit_Framework_TestListener、Netbeans 和 PHPUnit xml 配置

发布于 2024-11-08 03:03:22 字数 1614 浏览 2 评论 0原文

目前我有一个运行 Netbeans、PHPUnit Framework 和 SpiraTeam 的设置。

我正在尝试配置我的 Netbeans 以正确读取侦听器的 xml 配置。

目前似乎根本没有添加监听器。

我知道它正在读取 xml 文件,因为当我没有设置 TestSuite 时,该文件将控制运行哪些测试。

我当前的 phpunit.xml:

<listeners>
   <!-- Not loading this? -->
  <listener class="SpiraListener_Listener" file="PHPUnit/Util/SpiraListener/Listener.php">

   <!-- HOW CAN THIS WORK??? -->
  <int>3</int>

  </listener>
</listeners>

<testsuites>
  <testsuite name="TestSuite">
    <file>./TestSuite.php</file>
  </testsuite>
  <testsuite name="SeleniumTestSuite">
    <file>./selenium_ide_suites/TestSuite.php</file>
  </testsuite>
</testsuites>

<filter>
    <whitelist>
        <directory suffix=".php">../models/</directory>
        <directory suffix=".php">../system/</directory>
        <directory suffix=".php">../controllers/</directory>
        <exclude>
            <directory>../controllers/app_addons/</directory>
            <directory>../controllers/utilities/</directory>
        </exclude>
    </whitelist>
</filter>

测试将按预期运行,但未添加侦听器。 (也没有给出错误)

所以我真的很困惑下一步该去哪里!

除此之外,如何将参数传递给类?

http://www.phpunit.de/manual/current/en/appendixes .configuration.html

说您可以在 xml 的 Listener 元素中添加更多数据,但该类刚刚实现,这是如何使用/工作的?

感谢您的帮助! ——罗恩

Currently I have a setup running Netbeans, the PHPUnit Framework and SpiraTeam.

I am trying to configure my Netbeans to properly read the xml config for Listeners.

Currently is doesn't seem to be adding the listener at all.

I know it's reading the xml file because when I do not set a TestSuite this file will control what tests are run.

My current phpunit.xml:

<listeners>
   <!-- Not loading this? -->
  <listener class="SpiraListener_Listener" file="PHPUnit/Util/SpiraListener/Listener.php">

   <!-- HOW CAN THIS WORK??? -->
  <int>3</int>

  </listener>
</listeners>

<testsuites>
  <testsuite name="TestSuite">
    <file>./TestSuite.php</file>
  </testsuite>
  <testsuite name="SeleniumTestSuite">
    <file>./selenium_ide_suites/TestSuite.php</file>
  </testsuite>
</testsuites>

<filter>
    <whitelist>
        <directory suffix=".php">../models/</directory>
        <directory suffix=".php">../system/</directory>
        <directory suffix=".php">../controllers/</directory>
        <exclude>
            <directory>../controllers/app_addons/</directory>
            <directory>../controllers/utilities/</directory>
        </exclude>
    </whitelist>
</filter>

And the tests will run as expected but no listener was added. (no error given either)

So I'm really confused as to where to look next!

In addition to that How can you pass params to the class?

http://www.phpunit.de/manual/current/en/appendixes.configuration.html

Says you can add more data in the Listener element of the xml BUT the class is just implemented how is this used / working?

Thanks for any help!
--Ron

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

染年凉城似染瑾 2024-11-15 03:03:22

看起来你的监听器的语法有点不对劲。

尝试:

<listeners>
  <listener class="SpiraListener_Listener" file="PHPUnit/Util/SpiraListener/Listener.php">
    <arguments>
      <integer>3</integer>
    </arguments>
  </listener>
</listeners>

Seems like the syntax of your listener is a little off.

Try:

<listeners>
  <listener class="SpiraListener_Listener" file="PHPUnit/Util/SpiraListener/Listener.php">
    <arguments>
      <integer>3</integer>
    </arguments>
  </listener>
</listeners>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文