SimpleTest is a great testing framework for PHP, with a Drupal module available too.
Many tests are based on assert statements, but this patterns doesn't work for functions which are expected to throw Exceptions.
In that case the following pattern is often useful.
<?php
try {
foo($bar);
pass('Foo Bar worked');
} catch (MyException $e) {
$this->fail($e->getMessage());
}
?>


Post new comment
Got something to add - just enter a comment
all other fields are optional.