Ronald Almeida
Ronald Almeida

Reputation: 120

PHPUnit, PHPUnit_Framework_TestListener, Netbeans and the PHPUnit xml config

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

Upvotes: 1

Views: 866

Answers (1)

Christopher Manning
Christopher Manning

Reputation: 4567

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>

Upvotes: 1

Related Questions