In hopes of getting myself and my coworkers to adopt automated unit testing methods in future projects, I would like to see a proper example on how it's done. Simple introductionary lessons to unit testing only cover very basic examples and they don't seem to convince anyone of the benefits unit testing can offer. What are some open source projects written in PHP that come with an extensive array of unit tests that are done "properly", and can be used as an example of how testing should be done?
closed as off-topic by gnat, GlenH7♦, user40980, Bart van Ingen Schenau, Dan Pichelman Oct 8 '13 at 16:18
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – gnat, GlenH7, Community, Bart van Ingen Schenau, Dan Pichelman
Most PHP frameworks these days are unit tests, for a good example of the difference in tools, Zend Framework uses PHPUnit and CakePHP uses SimpleTest. Their repos should be enough to get you started or writing "proper" unit tests.
Drupal, specifically Drupal 7, is probably one of the most high-profile and most comprehensively unit-tested public PHP projects, with built-in unit testing support, over 24,000 tests, and a requirement that all core contributions have tests.
Its unit testing support is based on SimpleTest, and has been in active use for a couple of years now. One of the neat things that Drupal does is test all patches that are attched to issue queues, giving feedback to contributors discussing a particular issue without having to manually apply patches themselves (example).