If you’re looking to try unit testing in PHP, I cannot recommend Marcus Baker’s Simple Test highly enough. There are several good unit testing frameworks for PHP, (most of them, including PEAR’s, cryptically named PHPUnit) but once I tried Simple Test I stuck with it, for one basic reason: documentation.

Unusually well developed documentation was what first drew me to SimpleUnit. Not only is the API outlined in detail, but there’s an introductory tutorial to unit testing and test-driven development, with plenty of examples of how to use Simple Test. I was up and running in no time and was immediately hooked. Take this as a lesson: clear documentation attracts users/developers.

Mock object support is a nice bonus, too. Mock objects support unit testing by simulating real objects that are too difficult to set up and take down. By coding to an interface, and substituting a mock object that uses that same interface, you can more effectively test an individual unit. For a quick, accessible overview, Simple Test’s documentation works well, and I also suggest a sample chapter (PDF) from Andrew Hunt and David Thomas’s just-published Pragmatic Unit Testing. Simple Test is no longer the only PHP testing framework to offer mock object support, although I believe it was the first and was another reason I stuck with it.