我按照书上的步骤安装了PHPUnit:
sudo pear channel-discover pear.phpunit.de
sudo pear install phpunit/PHPUnit
包含路径是在
/etc/php5/cli/php.ini
中添加的。include_path = ".:/usr/share/php"
$ ls /usr/share/php/PHPUnit/
Extensions Framework
但是现在,如果我想运行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
当我尝试按照PHPUnit手册http://www.phpunit.de/manual/3.6/en/writing-tests-for-phpunit.html的指示在Zend Framework上下文之外进行操作时,当然也会遇到
phpunit: command not found
的问题。我感觉我可能漏掉了一些关键内容...
解决方案:
看起来PEAR通道存在问题,重新添加另外两个后,问题得以解决。
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com
export PATH=$PATH:/usr/share/php/PHPUnit
,但是没有任何变化。但是正如你在上面看到的,在目录/usr/share/php/PHPUnit
中只有2个子目录,没有什么可以执行的东西。 - Hannes/usr/share/php/PHPUnit
作为一个合适的匹配项 - 但是在重新安装整个东西之后,现在似乎可以工作了 - 谢谢 - Hannes