Reputation: 4088
I am trying to upgrade PHPUnit to latest version but I am getting error "install failed".
I installed PHPUnit with some online tutorial.
$ phpunit --version
PHPUnit 5.1.3 by Sebastian Bergmann and contributors.
I believe the current version is 5.5. I am trying the following command.
$ 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
I tried different command from another tutorial:
$ 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
I am new to Ubuntu so kindly help me to solve this issue.
Upvotes: 0
Views: 951
Reputation: 72226
sudo pear install -a -f phpunit/PHPUnit
PHPUnit discontinued the installation using PEAR in April 2014. The most recent versions that can be installed using PEAR are 3.7.35 and 4.0.17.
Take a look at the PHPUnit documentation and pick one of the methods described there. Make sure your system passes the requirements (PHP version) before starting.
The PHP Archive (PHAR) installation method can be used to install PHPUnit globally or only for one user. To install it globally, run which phpunit
before installation to find out if your current version is installed in /usr/local/bin/phpunit
or somewhere else and put the path returned by this command in the mv
command. To install it locally just skip the mv
command (but remember where you installed it or put it into the path).
The Composer method is easier and it is the best if your project already uses Composer to manage its dependencies. Its main advantage is that different projects that uses different versions of PHP can use different versions of PHPUnit.
If your current version of PHPUnit was installed by Ubuntu then the best method to upgrade it is to use the tools provided by Ubuntu. Run:
sudo apt-get install phpunit
to upgrade PHPUnit to the most recent version provided by Ubuntu. Unfortunately, like all the other distributions, Ubuntu doesn't provide the cutting edge versions of software programs but an older, stable, well-tested version.
Upvotes: 2