Install PHPUnit

Firstly, run:

sudo pear channel-discover
sudo pear install

Then run:

sudo pear channel-discover

//this may take a while depending on your internet speed
pear install –alldeps

p.s. 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).