The second training session I attended was on PHPUnit and Selenium. PHPUnit is a testing framework for PHP developers which allows them to write their own code tests, and provides useful output on where tests failed. Selenium is an additional testing tool that allows you to playback browser-based tests. Combined, these two tools can do a plethora of tests on a web application.
One of the main driving points of the tutorial was that despite any impact on implementation costs, planning to test from the beginning has higher overall code quality. Code quality is important as the higher the quality of your code, the less you'll have to spend in maintaining it.
Much like my Flex tutorial, I don't quite feel qualified to really show any code. However, there were some cool tips that Sebastian Bergmann, the current maintainer of PHPUnit and presenter of the tutorial, gave concerning PHPUnit 3.2 (which, by the way, is feature complete and is just waiting on some documentation before they release it). One tip is that you can group tests together with the PHPDoc @group [group] command in the comment block before your method or function. Then, via PHPUnit you can run select group tests by running phpunit --groups [group] [file] and only those groups would run. An @assert ([values]) [operator] [expected] can also be used to automatically create an assertion test for the method/function. Again, very cool.
There were a number of really good resources that Sebastian brought up, so I wanted to link to them here: