[英]Cant able to upgrade PHPUnit in ubuntu
我正在尝试将PHPUnit升级到最新版本,但出现错误“安装失败”。
我通过一些在线教程安装了PHPUnit。
$ phpunit --version
PHPUnit 5.1.3 by Sebastian Bergmann and contributors.
我相信当前的版本是5.5。 我正在尝试以下命令。
$ sudo pear install -a -f phpunit/PHPUnit
Attempting to discover channel "phpunit"...
Attempting fallback to https instead of http on channel "phpunit"...
unknown channel "phpunit" in "phpunit/PHPUnit"
invalid package name/package file "phpunit/PHPUnit"
install failed
我尝试了与另一个教程不同的命令:
$ pear config-set auto_discover 1
config-set succeeded
$ pear upgrade
downloading Archive_Tar-1.4.2.tgz ...
Starting to download Archive_Tar-1.4.2.tgz (20,624 bytes)
........done: 20,624 bytes
upgrade ok: channel://pear.php.net/Archive_Tar-1.4.2
$ pear install pear.phpunit.de/PHPUnit
Attempting to discover channel "pear.phpunit.de"...
downloading phpunit.de ...
Starting to download phpunit.de (5,392 bytes)
.....done: 5,392 bytes
unknown channel "pear.phpunit.de" in "pear.phpunit.de/PHPUnit"
invalid package name/package file "pear.phpunit.de/PHPUnit"
install failed
我是Ubuntu的新手,所以请帮助我解决此问题。
须藤梨安装-a -f phpunit / PHPUnit
PHPUnit在2014年4月停止使用PEAR进行安装 。可以使用PEAR安装的最新版本是3.7.35和4.0.17。
查看PHPUnit文档,然后选择其中描述的方法之一。 在开始之前,请确保您的系统通过了要求(PHP版本)。
PHP Archive(PHAR)安装方法可用于全局安装PHPUnit或仅用于一个用户。 要全局安装它, which phpunit
在安装前运行which phpunit
,以了解当前版本是安装在/usr/local/bin/phpunit
还是其他位置,并将此命令返回的路径放在mv
命令中。 要在本地安装它,只需跳过mv
命令(但请记住将其安装在哪里或放在路径中)。
如果您的项目已经使用Composer来管理其依赖项,则Composer方法更容易,并且是最好的方法 。 它的主要优点是,使用不同版本的PHP的不同项目可以使用不同版本的PHPUnit。
如果当前版本的PHPUnit是由Ubuntu安装的,则升级它的最佳方法是使用Ubuntu提供的工具。 跑:
sudo apt-get install phpunit
将PHPUnit升级到Ubuntu提供的最新版本。 不幸的是,与所有其他发行版一样,Ubuntu没有提供软件程序的最新版本,而是提供了较旧的,稳定的,经过测试的版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.