Page 1 of 1

[SOLVED] PHPUnit class autoload

Posted: Sat May 08, 2010 5:26 pm
by lunarnet76
Hi everyone!

I'm facing an awful problem ...
I can't use autoload in PHPUnit at all...
I have a bootstrap

Code: Select all

<?php
 function myAutoload(){
         trigger_error('we are using the autoload!',E_USER_ERROR);
          exit;
}
 spl_autoload_register('myAutoload');
?>
and I call PHPUnit with php phpunit --bootstrap bootstrap.php testClass.php

and my test class

Code: Select all

 class ClassTest extends PHPUnit_Framework_TestCase{
   

    public function test1(){
        new UnexistantClass();
    }
}
but ... the autoloader is never called ... what should I do !?

Thanks in advance ;-)

ps: I already tried to have the autoloader in the setUp method, it did not change a thing, I also tried with a simple __autoload()

=> Finally it was only because of the include path and that trigger_error in an autoload class is not caught by PHPUnit ...