Zend Framework (PHPUnit) Tests won'r run (phpunit: command not found / class 'PHPUnit_Framework_TestCase' not found)

I installed PHPUnit from the book:

sudo pear channel-discover pear.phpunit.de sudo pear install phpunit/PHPUnit 

The included path is added to /etc/php5/cli/php.ini

 include_path = ".:/usr/share/php" $ ls /usr/share/php/PHPUnit/ Extensions Framework 

But now, if I want to run Tests for Zend Framework

 user@server :/var/www/page/tests$ ./runtests.sh + phpunit --verbose AllTests ./runtests.sh: line 72: phpunit: command not found user@server :/var/www/page/tests$ php AllTests.php PHP Fatal error: Class 'PHPUnit_Framework_TestCase' not found in /var/www/page/tests/Zend/Acl/AclTest.php on line 37 

Of course, I also get phpunit: command not found when I try to follow the instructions in the PHPUnit manual http://www.phpunit.de/manual/3.6/en/writing-tests-for-phpunit.html outside the context of the Zend Framework.

I get the feeling that I'm missing something substantial here ...

solvable

It looks like there was a problem with the PEAR channels, after adding the other 2 it worked again:

 pear channel-discover components.ez.no pear channel-discover pear.symfony-project.com 
+7
source share
1 answer

Since the problem was resolved in the comments, I am just making a real answer to take stock.

The cause of the problem was the lack of the phpunit command. Reinstalling phpunit and setting the PATH variable to the folder containing the phpunit command ( export PATH=$PATH:/path/to/folder/with/phpunit ) solved the problem.

+6
source

All Articles