phpunit (and simpletest?) and eclipse pdt tip

Discussion of testing theory and practice, including methodologies (such as TDD, BDD, DDD, Agile, XP) and software - anything to do with testing goes here. (Formerly "The Testing Side of Development")

Moderator: General Moderators

Post Reply
koen.h
Forum Contributor
Posts: 268
Joined: Sat May 03, 2008 8:43 am

phpunit (and simpletest?) and eclipse pdt tip

Post by koen.h »

I've figured out a way to use phpunit in eclipse pdt. May be of interest for those others who don't want to pay $399 for zend studio. It's simple and probably easy to create an eclipse plugin for it.

1. Open menu run->external tools->open external tools dialog.

2. Click program and add new launch configuration. Give it a name you like.

3. In the main tab under location browse file system and add your php thingy.

4. Under arguments add this:

Code: Select all

-B "require_once 'PHPUnit/Util/Filter.php';
PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
require 'PHPUnit/TextUI/Command.php';" ${resource_name}
5. Under working directory ${container_loc}
6. Go to tab 'common', check 'allocate console'. The console will dispaly the phpunit test results.
Also check 'display in favorites menu'.

Apply all and run. Note: you have to have a test file in your editor, otherwise it will give an error.
If you don't like it you can remove it easily in the external tools dialog so no harm will be done.

I think the same process would apply to simpletest. Maybe even simpler since step 4 would be simpler. But I haven't done this.
koen.h
Forum Contributor
Posts: 268
Joined: Sat May 03, 2008 8:43 am

Re: phpunit (and simpletest?) and eclipse pdt tip

Post by koen.h »

Also, if someone know how to make a plugin out of this so I could use a key binding that would be great.
Post Reply