|
From: Jeff M. <je...@pr...> - 2004-02-15 03:36:27
|
Hello,
I was looking for some advise regarding testing for errors. If I have
some code that I want to test of the form:
if (condition1) {
trigger_error()
}
if (condition2) {
trigger_error()
}
And I have the following test case
// trigger error condition 1
$this->assertError();
When simpletest records the errors, it allows execution to continue,
where in the program, normally execution would not continue past the
first trigger_error statement. This causes two errors to be triggered
(when condition 2 is also true). The second error occurs only because
the first error was ignored.
Now, my test passes because an error did occur, but simpletest records
the second error as an exception and shows a red bar. I'd like to have
a green bar. :)
Should I put a swallowErrors() call after my assertError() to prevent
the exceptions?
If so, should I put a swallowErrors() call at the end of every test
case that calls assertError?
Thanks,
Jeff
|