1
0
mirror of synced 2024-12-13 14:56:01 +03:00

Added a try/catch block around the running of each test to catch unexpected

exceptions and log them.
This commit is contained in:
meus 2007-09-17 22:43:53 +00:00
parent 879a213990
commit 82a248fee7

View File

@ -40,7 +40,12 @@ class GroupTest extends UnitTestCase
if ( ! $this->shouldBeRun($testCase, $filter)) { if ( ! $this->shouldBeRun($testCase, $filter)) {
continue; continue;
} }
$testCase->run(); try{
$testCase->run();
}catch(Exception $e){
$this->_failed += 1;
$this->_messages[] = "Unexpected exception thrown with message [" . $e->getMessage() . "] in " . get_class($testCase) . " on line " . $e->getLine();
}
$this->_passed += $testCase->getPassCount(); $this->_passed += $testCase->getPassCount();
$this->_failed += $testCase->getFailCount(); $this->_failed += $testCase->getFailCount();
$this->_messages = array_merge($this->_messages, $testCase->getMessages()); $this->_messages = array_merge($this->_messages, $testCase->getMessages());