Well after about 2 hours of head desking I have I got the above to all work nicely together.
Firstly you need to install all the prerequisites. If you are using you can install most of these though apt-get. I assume you have LAMP set up locally and you will be testing on this
sudo apt-get install php5-dev php-pear php5-cli php5-xdebug phpunit
This will install a bunch of stuff you will need. If you want to install from source feel free.
So next you need eclipse installed. I would not recommend apt-get install eclipse as this version is quite old. It is quite easy to ‘install’ eclipse (all you have to do is download it from their website, and then run the executable and boom (you need java installed)). There are loads of tutorials online about what java to install, etc so I won’t cover that now.
Once you have eclipse install you need PDT installed in eclipse. Again loads of tutorials here so go google it. You also need MakeGood installed (from the market place).
Once that is all done you can tell eclipse about it!
Now add the PHP Libraries
Window -> Preferences -> PHP -> PHP Libraries
Click the New button, give the Library a name (Doesn’t matter what)
Then Click on this and then the Add External folder. You will want to add /usr/share/php
You now need to tell your PHP project to use the library and MakeGood about your tests.
Right click on the project -> Properties -> PHP Include Path -> Libraries (Tab).
Click the Add Library button -> Select User Library -> Next -> Tick whatever you called your library -> Finish
Still in the Project Properties -> MakeGood
Select PHPUnit, you can enter a XML Configuration File but it seems to work without it. See this for more about PHPUnit XML files
Then add some Test Folders.
You also need to tell apache to use xdebug
Edit /etc/php/conf.d/xdebug.ini and add
xdebug.remote_enable=On xdebug.remote_host="localhost" xdebug.remote_port=9000 xdebug.remote_handler="dbgp"
to the bottom. Then restart apache
sudo service apache2 restart
Now you are ready to get testing!
You may come across this bug when running tests.
PHP Fatal error: require_once(): Failed opening required 'PHP/CodeCovera
ge/Filter. php' (include_ path='. :/usr/share/ php:/usr/ share/pear' ) in /usr/bin/phpunit on line 38
Follow the steps listed in the bug report (basically reinstall PHPUnit from pear and apt-get)