From 82a248fee7e75aded2689ddd0cbd2766a6742e0c Mon Sep 17 00:00:00 2001 From: meus Date: Mon, 17 Sep 2007 22:43:53 +0000 Subject: [PATCH] Added a try/catch block around the running of each test to catch unexpected exceptions and log them. --- tests/Test.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/Test.php b/tests/Test.php index c305e8fc1..cc5f631bc 100644 --- a/tests/Test.php +++ b/tests/Test.php @@ -40,7 +40,12 @@ class GroupTest extends UnitTestCase if ( ! $this->shouldBeRun($testCase, $filter)) { 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->_failed += $testCase->getFailCount(); $this->_messages = array_merge($this->_messages, $testCase->getMessages());