加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

zend-framework – Zend Framework(PHPUnit)测试不会运行(phpuni

发布时间:2020-12-13 17:52:16 所属栏目:PHP教程 来源:网络整理
导读:我按书安装了 PHPUnit: sudo pear channel-discover pear.phpunit.desudo pear install phpunit/PHPUnit include路径添加在/etc/php5/cli/php.ini中 include_path = ".:/usr/share/php"$ls /usr/share/php/PHPUnit/Extensions Framework 但现在,如果我想运
我按书安装了 PHPUnit:
sudo pear channel-discover pear.phpunit.de
sudo pear install phpunit/PHPUnit

include路径添加在/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

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

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

解决了

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

pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com
由于问题在评论中得到了解决,我只是总结了一个真正的答案.

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读