How to install PEAR and PHPUnit in Debian/Ubuntu

In general terms, it’s very easy to install/upgrade new software in APT distros such as Debian/Ubuntu.

I don’t want to say doing so for PHPUnit or PEAR is more difficult, but has a little, tricky part, upgrading PEAR. If you don’t upgrade PEAR, PHPUnit will complain about an insufficient version and the installation will abort.

Summarizing:

sudo apt-get install php-pear
sudo pear channel-update pear.php.net
sudo pear upgrade pear
sudo pear channel-discover pear.phpunit.de
sudo pear channel-discover pear.symfony-project.com
sudo pear channel-discover components.ez.no

sudo pear install -a phpunit/PHPUnit

Additionally, if you want to include code coverage in your tests, you have to install the xdebug PHP extension.

sudo apt-get install php5-xdebug

Happy testing!

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>