簡體   English   中英

無法在Ubuntu中升級PHPUnit

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM