Zend Framework(PHPUnit)测试不会运行(phpunit:命令未找到/类'PHPUnit_Framework_TestCase'未找到)

Han*_*nes 7 phpunit zend-framework command-line-interface zend-test

我按书安装了PHPUnit:

sudo pear channel-discover pear.phpunit.de
sudo pear install phpunit/PHPUnit
Run Code Online (Sandbox Code Playgroud)

包含路径添加在 /etc/php5/cli/php.ini

include_path = ".:/usr/share/php"

$ ls /usr/share/php/PHPUnit/
Extensions  Framework
Run Code Online (Sandbox Code Playgroud)

但是现在,如果我想运行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
Run Code Online (Sandbox Code Playgroud)

当然,phpunit: command not found当我尝试遵循Zend Framework Context之外的PHPUnit手册http://www.phpunit.de/manual/3.6/en/writing-tests-for-phpunit.html中的说明时,我也会得到一个.

我得到的感觉我在这里缺少必要的东西......

解决了

看起来PEAR频道存在问题,在添加其他2之后再次,它工作:

pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com
Run Code Online (Sandbox Code Playgroud)

Mar*_*cin 6

由于问题在评论中得到了解决,我只是总结了一个真正的答案.

问题的原因是缺少phpunit命令.重新安装phpunit并将变量PATH设置到包含phpunit命令(export PATH=$PATH:/path/to/folder/with/phpunit)的文件夹解决了这个问题.