Is there any integration of PHPUnit with Eclipse PDT?
If not, are there any plans to do so?
We've developed an Eclipse plugin called MakeGood that integrates PHPUnit and more testing frameworks with Eclipse PDT.
MakeGood is a continuous test runner to run unit tests on Eclipse PDT.
MakeGood provides fast feedback by automated workflows for running tests, tracking failures and errors and fatal errors. This will help developers to do Test Driven Development (TDD) and Continuous Testing.
For more information, visit our website at: https://github.com/piece/makegood/wiki
There is defnitely integration for Eclipse PDT and PHPUnit. both PHPSRC and MakeGood work well though I am a fan of MakeGood for phpunit phpsrc comes with other goodies like CodeSniffer. I have branched a PHPUnit CodeSniffer Standard on github that validates the quality of phpunit tests which I can run with the Eclipse PHP Tools CodeSniffer plugin. This has updates for new phpunit package like setUp and tearDown.
makes sure there is assertions in tests. Something devs like to leave out when trying to meet code coverage metrics
Makes sure there is no more than 1 assertion per test. A best practice
Setting up PDT in Eclipse is not straightforward.
There's a lot of tiny details involved Here's the high level steps.
1 Windows update
2 Install JRE a. http://www.java.com/en/download/index.jsp
3 Create a folder C:\eclipse\workspace
4 Install eclipse pdt
a. http://www.zend.com/en/downloads/thankyou?package=573
5 Install xampp –win32-1.81-vc9
a. http://sourceforge.net/projects/xampp/files/XAMPP%20Windows/1.8.1/xampp-win32-1.8.1-VC9-installer.exe/download
6 Install pear phpunit
pear clear-cache
pear upgrade pear
pear update-channels
pear upgrade --alldeps -f
pear channel-discover pear.phpunit.de
pear channel-discover pear.symfony-project.com
pear channel-discover components.ez.no
pear install --alldeps phpunit/PHPUnit
7 Install Xdebug plugin
a. http://xdebug.org/files/php_xdebug-2.2.1-5.4-vc9.dll
b. Phpinfo settings for xdebug
[xdebug]
zend_extension = "C:\xampp\php\ext\php_xdebug-2.2.1-5.4-vc9.dll"
xdebug.remote_enable=1
xdebug.remote_handler="dbgp"
xdebug.remote_mode="req"
xdebug.remote_port=9000
xdebug.remote_host = "127.0.0.1"
xdebug.remote_log="C:\xampp\php\logs"
It took me nearly 3 days to finally get everything right so I put together a video tutorial
Good luck!
(disclaimer: I am absolutely not the developer of the project I'm speaking about here; only a user ^^ (And as I don't know JAVA, it would be quite hard for me to help by contributing code... So this is my way of helping :-) ) )
There is currently work in progress on that side : a few weeks ago (maybe no more than two weeks), the first of a project of integrating phpunit in Eclipse has been released:
What it does:
For some kind of screenshot, see http://code.google.com/p/phpunit4eclipse/wiki/j2phpUnitWrapper
Unfortunately, it is not (yet?) developed as an Eclipse plugin:
Anyway, this is work in progress, the project is still quite young, and it's only a first step...
A google group has been created for that project a few time ago: http://groups.google.com/group/phpunit4eclipse-user/
It is currently empty, but I'm sure it would help if some people joined in, gave their thoughts, and why not, helped!
I also run PHPUnit as an external tool like DavidWinterbottom proposed.
One thing I also add depending on the type of project is going into Build Options tab and selecting first options after : "run the builder :". This triggers the unit tests to be run every time you save a file. This is great to get a really quick red-green-refactor feedback loop.
I have posted the entire steps with screenshots here : http://nicholaslemay.blogspot.com/2010/02/using-eclipse-phpunit-as-automatic.html
It is possible to integrate PHPUnit with PDT in a simple way (these settings aren't fully generic but should be a good starting point).
Now select Run > External Tools > PHPUnit to execute the selected test file. This simply executes phpunit and sends STDOUT to the Eclipse terminal. Simple but effective.
Subsequently, you can use the icon with a green arrow and red toolbox to run PHPUnit without having to navigate the menus.
You have and integration of PHPUnit on top of PDT in Zend Studio. There is a CE edition too.