In the following steps, we will upgrade PEAR and install PHPUnit via PEAR, for the corresponding environments:
1. Run the command prompt as an administrator, go to the PHP installation directory where the
pear.bat
file belongs (D:\xampp\php), and execute the following command:pear upgrade pear
This upgrades the existing PEAR installation. In Ubuntu or Mac OS X system, run the following command:
sudo pear upgrade pear
In the case of MAMP, if you encounter the error sudo: pear: command not found, then refer to the section Configuring MAMP issues.
2. To install the latest PHPUnit, type the following two commands:
pear config-set auto_discover 1 pear install pear.phpunit.de/PHPUnit
It discovers the download channels automatically and installs the latest PHPUnit along with the available packages.
3. To check the PHPUnit installation, run the following command:
phpunit version
You will see a command similar to the following:
PHPUnit 3.6.10 by Sebastian...