Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHPUnit Listener loaded but unused

I'm using PHPUnit 3.4.14 and I'm trying to add a Listener.

I wrote a simple one:

class My_Test_Listener implements PHPUnit_Framework_TestListener
{
    public function addError(PHPUnit_Framework_Test $test, Exception $e, $time)
    {
...

I declared it in my phpunit.xml file:

<phpunit bootstrap="./bootstrap.php">
    <testsuites>
        <testsuite name="auth">
            <directory>./library/Ademe/Auth</directory>
        </testsuite>
    </testsuites>
    <listeners>
        <listener class="Listener" file="./library/My/Test/Listener.php">
    </listener>
    </listeners>
</phpunit>

My class is loaded (if I omit to implement one of the method, it says so in the logs), but I never go inside thoses methods. I tried this for instance :

public function startTestSuite(PHPUnit_Framework_TestSuite $suite)
{
    die('startTestSuite');
}

Do you have any idea of what could be missing?

Thanks!

like image 323
frinux Avatar asked Dec 04 '12 08:12

frinux


1 Answers

OK I got it, the class name was wrong, allthough no error was reported. I should have done this instead:

<phpunit bootstrap="./bootstrap.php">
    <testsuites>
        <testsuite name="auth">
            <directory>./library/Ademe/Auth</directory>
        </testsuite>
    </testsuites>
    <listeners>
        <listener class="My_Test_Listener" file="./library/My/Test/Listener.php">
    </listener>
    </listeners>
</phpunit>
like image 123
frinux Avatar answered Oct 21 '22 08:10

frinux