Impressions of PHP Development on Netbeans 6.7

Here is yet another review of Netbeans 6.7 Beta (I have not yet downloaded the release candidate). I have started to use daily Netbeans 6.7 and started to do everything I do with Netbeans, including remote development (sychronization) and debugging of PHP Scripts. Which you are used to these if you were using Netbeans 6.7 nightly builds. What you might not be familiar with are the unit test creation, code coverage plugin and subversion capabilities of Netbeans (or I have stopped using TortoiseSVN on Windows and shell on *nix)

I will mention in this post a bit about remote synchronization. A different way I had mentioned on my previous post. This time, I’m not mounting the remote server via ssh and load it to Netbeans using a plugin named Mount Filesystems (Which seems to be missing on the plugin list. I wonder what happened to it because I cannot find anything about it and seems like I was the only who found it, and was lucky enough to use it. Strange, was I dreaming?). While creating a new project you are selecting that your running configuration is on a remote server. You set it up (yes, you can select sftp(ssh)) and you are ready to go!. You can change the time when the files will be uploaded. On save or on run or something like it. But here is the problem. If there is already a folder which is on that name, know that that folder is no more! So be careful. And here it’s if you are using subversion, .svn folders are not uploaded so you can only take a diff on your local copy. I would have liked that, the folder were not deleted and the files existing be overwritten. But anyway it works pretty cool.

If you are lucky enough and a Linux or Mac OS user you can select your know ssh file and private key file to Netbeans and disable the confirmation of the certificate and authentication alert on every time something is uploaded. On Windows copy paste from somewhere or just get used to getting annoyed with alerts.

So while the remote development is cool, I also liked the part with code coverage and unit test creation. With just right clicking and selecting Tools – Create Unit Tests unit test file class is automatically created with lots of function marked as incomplete. The best part, a skeleton unit test is created, bad part, that unit tests as they are not testing anything and they are not doing actual testing (no checking for valid testing with appropriate and not appropriate values), it deceives you on code coverage screens. But it’s great as a skeleton and helps you to create fast tests. Some problems are in the class loading. If you have a bootstrap, and if you make the require things there and not on the class descrpitions, you won’t be able to create tests. You should first add the require_once() commands (phpunit must also be installed but I pass this case.) and then auto test creation can be done.

A missing point is that, even if you create the tests, you cannot right click on the file and click on Test. I don’t know why. It might be a problem about my configuration too.

Code coverage information is really great! I really mean it’s great. It can be deceiving some times because, every function called during the test run is listed as code covered, this includes the functions you have called during setUp() and tearDown(). This creates a deception point, because you have not actually written a test about them but you that they are covered. Yes they are executed but they are not actually “tested”. So you must be careful about it. I also liked the clean interface on unit test and code coverage report. But if the non matching strings are long, it’s hard to find out the difference (I was testing xml strings and difference part were not working, this might be because of beta or xml, I do not know. Actually It was working. It was showing “x”es for every character which was not matching but I was not able to understand it on the first time.). It’s also cool to see green lines which means covered and red lines which are not covered on the editor page whie editing the file you have tested! It’s really cool! I suppose xdebug must be installed for code coverage information but I’m not sure. You have to install xdebug anyway for debugging your applications, so it’s a must:)

Another “killer” feature is the subversion support. I’m a guy used to shell, when something is involved about subversion, writing svn diff command is faster then right clicking. And I always like the unified diff view which Netbeans was lacking. But It’s also great to see one file, side by side, one as modified version and second as the base version. And now, Netbeans also added the export diff and import diff command (not used yet). Export diff creates a diff file just like svn diff command does and highlight it. There were little problems about the the highlighting on the beta. Some non deleted and/or added/modified lines as red instead of blue or white. But I suppose it will be corrected soon. You can also attach the patches on issues directly from the Netbeans interface. For the moment only Bugzilla is supported. But I’m sure trac and/or redmine are on the way too.

As Netbeans create project releated files and folders, they are added to the svn, once everything is checked out. And it’s pretty easy to check them in, with a commit command. Don’t forget to set that folder as ignored to prevent checking in unrelated files to your code base.

The only bad thing about export diff command is that you have to create a file first and only later you can see the diff. It might be better if the export diff command had opened another editor tab as unnamed and only when I clicked on save ask me to where to save (or ask me if I want to discard the changes done.)

Something I have missed was about, automatic PHPDoc creation, which I have supported (some one had already seen the problem I had seen and had opened an issue) an issue created. I hope that it gets accepted, because it’s really cool. (Well, here is the thing, once you do it, you should surprise and just say, “ohh,… Cool!”)

So it was a bit long for a simple review but this was the impressions I had gathered using Netbeans 6.7 Beta. I suppose final release will be much cooler! I always had a sympathy towards Netbeans but never had the time to use it long times as I’m not a Java nor C/C++ developer. It’s really great to be able to use it with PHP and with this great features. Hope that it gets better and better! (yes, I want Zend Framework Support with Zend_Tool, that really would be awesome!!!!)