Firstly, run:

sudo pear channel-discover pear.symfony.com
sudo pear install pear.symfony.com/Yaml

Then run:

sudo pear channel-discover pear.phpunit.de

//this may take a while depending on your internet speed
sudo 
pear install –alldeps pear.phpunit.de/PHPUnit

p.s.

http://pear.phpunit.de/ is the most up to date official PHPUnit site. If you install it from the default pear package, it will be version 3.4 or 3.5 which has a lot of the useful features missing.  It’s possible this guide will fail because there are some dependencies missing. If that happens, follow the instructions on your screen to install the missing packages first (e.g. php-dom).