【问题标题】:Cant able to upgrade PHPUnit in ubuntu无法在 ubuntu 中升级 PHPUnit
【发布时间】:2016-12-13 18:42:33
【问题描述】:

我正在尝试将 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 新手,请帮我解决这个问题。

【问题讨论】:

    标签: ubuntu phpunit pear


    【解决方案1】:

    sudo pear install -a -f phpunit/PHPUnit

    2014 年 4 月的 PHPUnit discontinued the installation using PEAR。可以使用 PEAR 安装的最新版本是 3.7.35 和 4.0.17。

    查看PHPUnit documentation 并选择其中描述的一种方法。启动前请确保您的系统通过要求(PHP 版本)。

    PHP Archive (PHAR) 安装方式可用于全局安装 PHPUnit 或只为一个用户安装。要全局安装它,请在安装前运行which phpunit,以查看您当前的版本是否安装在/usr/local/bin/phpunit 或其他位置,并将此命令返回的路径放入mv 命令中。要在本地安装它,只需跳过 mv 命令(但请记住您安装它的位置或将其放入路径中)。

    Composer method 更简单,如果您的项目已经使用 Composer 来管理其依赖项,那么它是最好的。它的主要优点是不同的项目使用不同版本的PHP,可以使用不同版本的PHPUnit。

    如果您当前版本的 PHPUnit 是由 Ubuntu 安装的,那么升级它的最佳方法是使用 Ubuntu 提供的工具。运行:

    sudo apt-get install phpunit
    

    将 PHPUnit 升级到 Ubuntu 提供的最新版本。不幸的是,与所有其他发行版一样,Ubuntu 不提供最先进的软件程序版本,而是提供较旧、稳定、经过良好测试的版本。

    【讨论】:

    • 尝试发现通道“phpunit”...尝试在通道“phpunit”上回退到 https 而不是 http...“phpunit/PHPUnit”中的未知通道“phpunit”包名/包文件无效“phpunit/PHPUnit”安装失败
    • 你真的读过你从 axiac 那里得到的答案吗?您收到这些错误是因为您尝试使用不再存在的安装方法。
    猜你喜欢
    • 2014-10-29
    • 1970-01-01
    • 1970-01-01
    • 2018-08-22
    • 2012-11-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多