With Zend Studio for Eclipse 7 approaching its release date, I find myself once again comparing it to NetBeans, my previous development environment. I can safely say that I'm enjoying the code templates and intelligent PHP refactoring support. I finally feel like something in the PHP community is approaching what C# and Java developers have with ReSharper.
I even managed to get the unit testing environment to work with my Zend Framework installation with a little bash scripting. I realized that the PHPUnit test runner built into netbeans requires certain command line arguments, but because its designed to do single class tests instead of using the phpunit.xml file, I had to override it.
Here's my batchtest.sh file:
#!/usr/bin/env bash cd ~/Sites/myproject/tests phpunit --configuration phpunit.xml $1 $2 #phpunit $1 $2 $3
with this file, I can set either to have phpunit behave like it normally would in NetBeans (line 4), or have it read my phpunit.xml file instead.
The result is a nice little test runner that's built into my development environment:


I'm still trying to integrate code coverage, but since I get HTML reports, I think I can handle switching to my web browser for that.
{ 7 comments… read them below or add one }
Do you have some advice when I use this shell script and got this message “PHPUnit (version ?.?.?) is too old …(minimum 3.3.0)…”
I have phpunit 3.3.17
I think you need to use the absolute path of the version of phpunit that you want to be running.
Hope that helps!
ok, i get in netbeans
‘”"C:\Program’ is not recognized as an internal or external command,
operable program or batch file.
i noticed if i run “phpunit” in cmd alls well. if i try to run a test in cmd eg. “phpunit test.php” i get that but the tests still run.
i think i’ve seen that dto somewhere before …
mmm indeed! from a unit test based off of the QuickBase API code that you posted:
http://blog.joshuamcginnis.com/2008/09/php-wrapper-for-quickbase/
@iceangel89, I would check to see that your path to netbeans is properly escapes (maybe the spaces in windows need some special treatment, like in unix where you need to put a ‘\’ before them.)
sorry, where do i put the batch file (if i use windows i use ‘.bat’ instead? any changes i need to make in the batch file?). how do i run it? i guess its in the config options image but its v small i cant see.
what does the $xxx mean? is the 1st and last line comments?