Okay, I have been getting into Unit Testing the past few days. With the help of Jon Lebensold’s screencast, I was able to jump right in quickly.
Right now I am looking into creating Mock Objects for my tests. I found this and this from zomg’s blog. Searching around, this is probably the easiest article to get myself started with Mock Objects in PHPUnit.
It seems like such a pain to set up unit testing… Have you been using it long enough to report if it is really worth the time, or what kinds of problems you find the most using it?
Hello Renowned Media, I am a beginner at using Unit Testing. In fact, I have just started using it.
To answer your question, I have had a million instances where in I made modifications on my functions/methods to fix a bug. The modification in turn broke the other functions/methods that depended on it. I only found out a few days after the fix. This is because I did not Unit Test my code.
Remember that testing first (writing unit tests before writing the code) is the best way to ensure your code is testable. I often write about object-oriented php, if you’re interested on my blog there is a step by step series on phpunit testing (I’ve put the link in the Website field, it’under the ‘php testing series’ tag).