Phpunit and autoloader

I am trying to use autoloader with phpunit as follows:

  • in phpunit.xml I put bootstrap="bootstrap.php"
  • in bootstrap.php I put

    define( 'TESTING', true );
    putenv( 'APPLICATION_ENV=testing' );
    
    
    function __autoload($className) {    
        include_once __autoloadFilename($className);
    }
    
    
    function __autoloadFilename($className) {
        return str_replace('_','/',$className).".php";
    }
    

When I try to run the phpunit command, I get an error:

Generating code coverage report, this may take a moment.
Fatal error: Method PEAR_Autoloader::__call() must take exactly 2 arguments in /usr/share/php/PEAR/Autoloader.php on line 211

Thanks for any help.

+3
source share

Source: https://habr.com/ru/post/1736442/


All Articles