Today I would like to inform you that we have added PHPUnit support to NetBeans. It is not finished yet (UI for test results is still missing) but I would like to show you how one can test his/her PHP sources in NetBeans today. If you are new to PHPUnit, be sure that you visit PHPUnit web site first to get all the required information.
First, be sure that PHPUnit is installed on your computer and PHPUnit script is known for NetBeans; to verify that, just open IDE Options (Tools > Options) and check whether the script has been found for you. If the script is not found, please let us know, preferably using our IssueZilla (component php, subcomponent project) so we can try to fix your case. The IDE Options should look like this:
Now it's time to create our first PHPUnit test - to do so, open any existing PHP project (or create a new one) and create a new PHP class (be sure that the name of the file is in the form of <the_name_of_PHP_class_defined_in_the_file>.php - for NetBeans, it's enough to invoke New > PHP Class...). Add some methods and right click the file in Projects view, select Tools > Create PHPUnit test... Please note that this action can be invoked for folders as well.
If it's the first time, IDE has to ask for a folder for tests:
Once this folder is set, it can be found in Project Properties dialog as well as in Projects view, of course.
After the tests are created, one can easily run them using Test action on project's node:
For now, only Output window is opened and the test results are displayed; but stay tuned, we plan to add UI for these results, similarly as for Ruby or Python support.
Of course, one is able to run or even debug only one particular test (labels are not final yet, Run/Debug are used for now, maybe we should change them to Run test/Debug test - what do you think?):
The last thing for today is that it is very easy to navigate between source (tested) class and test class - just right click anywhere in the editor and invoke Navigate action:
We hope that you will find NetBeans PHPUnit support useful!
PS: Currently we are discussing the relation between Test sources and Remote Web configuration of a PHP project - should tests be uploaded to a remote (S)FTP server? If yes, then where? What about if Tests are underneath Sources? And what if they are not? As you can see, there are quite many questions to solve. Any feedback is welcome, of course.