16th January 2009 - 3 minutes read time
PHPUnit is a unit testing framework, written in PHP, and which is used to test PHP code. You can integrate the testing that PHPUnit does into Phing. You might want to use Phing to create a nightly build that contains the latest version of your program. The last thing you want is Phing to create a nightly build that is riddled with errors.
The way around this is to use PHPUnit to test our code whilst we are running Phing. If any tests fail then Phing will not finish the build.
Create a target at the top of your build.xml file and make sure it is run first. Then add the following code to the target, This will use PHPUnit to test your code.