PHPUnit和Ubuntu-使用PEAR安装后包含路径的问题
我需要在我的Ubuntu盒上为一个web开发项目安装PHPUnit,但是我遇到了严重的问题。使用来自各种来源的建议,我通过PHPUnit和Ubuntu-使用PEAR安装后包含路径的问题,php,phpunit,Php,Phpunit,我需要在我的Ubuntu盒上为一个web开发项目安装PHPUnit,但是我遇到了严重的问题。使用来自各种来源的建议,我通过pear安装并尝试了以下方法: 当前,phpunit--version返回 PHPUnit 3.7.20 by Sebastian Bergman 在/usr/share中时,但在其他地方抛出错误 我的包含路径是 include_path = ".:/usr/share/php:/usr/share/php/PEAR:/usr/share/php/File/Ite
pear
安装并尝试了以下方法:
- 当前,
返回phpunit--version
PHPUnit 3.7.20 by Sebastian Bergman
/usr/share
中时,但在其他地方抛出错误
- 我的
包含路径是
include_path = ".:/usr/share/php:/usr/share/php/PEAR:/usr/share/php/File/Iterator"
- 我尝试了不同的变体,从简单的
到上面的完整字符串/usr/share/php
位于所有大写字母中,因为它位于该文件夹中PEAR
- 使用测试用例执行会导致
PHP Warning: require_once(File/Iterator/Autoload.php): failed to open stream: No such file or directory in /usr/share/php/PHPUnit/Autoload.php on line 64 PHP Stack trace: PHP 1. {main}() /usr/bin/phpunit:0 PHP 2. require() /usr/bin/phpunit:43 PHP Fatal error: require_once(): Failed opening required 'File/Iterator/Autoload.php'(include_path='/usr/share/php/libzend-framework-php') in /usr/share/php/PHPUnit/Autoload.php on line 64
返回pear列表-c phpunit
Installed packages, channel pear.phpunit.de: ============================================ Package Version State File_Iterator 1.3.3 stable PHPUnit 3.7.20 stable PHPUnit_MockObject 1.2.3 stable PHP_CodeCoverage 1.2.10 stable PHP_Invoker 1.1.2 stable PHP_Timer 1.0.3 stable PHP_TokenStream 1.1.5 stable Text_Template 1.1.2 stable
- 我已经确认
存在于Autoload.php
和php/PHPUnit/
php/File/Iterator/
- 经验证,我加载的
文件位于`/etc/php5/cli.php.iniphp.ini
php --info | grep "onfiguration"
任何其他建议都将不胜感激。在您的计算机上搜索名为Autoload.php的文件,其文件结构如下:
。/File/Iterator/Autoload.php
现在打开抛出错误的文件(/usr/share/php/PHPUnit/Autoload.php
),并包含一个指向该文件绝对路径的set\u include\u path
语句
你似乎有一个和我在MacOSX上遇到的问题非常相似的问题。有关更多信息,请查看此。如果所有这些都没有帮助,请尝试使用安装,我听说它没有这个问题。对于最近的项目,我正在使用安装PHPUnit和其他相关工具。这很简单:
## ... rest of the composer.json file
# "php -f composer.phar update --dev" to install
"require-dev": {
"phpunit/phpunit": "3.7.*"
},
然后,我还有一个shell脚本,可以从安装了本地安装脚本链接的./vendor/bin/目录中实际运行PHPUnit命令行工具,
但我更喜欢在我的项目中通过以下方式在全球范围内部署更新的:
composer.phar global require "phpunit/phpunit=dev-master"
这样,当我在Symfony项目的根目录下时,我就可以运行了
~/.composer/vendor/bin/phpunit -c app/ -v --filter testFireNotifications |tee phpunit.log
过滤器的最后一点是有选择地运行某些东西(实际上,更多的是通过crontab实现快速web自动化,而不是测试…)
即使是在当前的Ubuntu 14.04.2服务器上,repo也被一个过时的PHPUnit 3.7.28“stable”卡住了,所以我避开了这个定制安装提供的操作系统,它不会发生冲突(我没有将
~/.composer/vendor/bin
放在我的路径中).将/usr/share
添加到include路径,您可能会在该路径上获得更快或更好的答案。@Orangepill,不起作用。