From b5e6f79f5fec0709e6eeab4f5813f9c60dbec431 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 15 Dec 2008 09:45:55 +0000 Subject: Reapply patch to make tests always call teardown. Upstream ticket: http://dev.kohanaphp.com/ticket/960 --- modules/unit_test/libraries/Unit_Test.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'modules/unit_test/libraries') diff --git a/modules/unit_test/libraries/Unit_Test.php b/modules/unit_test/libraries/Unit_Test.php index e6010d3c..54366cb7 100644 --- a/modules/unit_test/libraries/Unit_Test.php +++ b/modules/unit_test/libraries/Unit_Test.php @@ -136,8 +136,12 @@ class Unit_Test_Core { $object->setup(); } - // Run the actual test - $object->$method_name(); + $e = null; + try { + + // Run the actual test + $object->$method_name(); + } catch (Exception $e) { } // Run teardown method if ($teardown === TRUE) @@ -145,6 +149,11 @@ class Unit_Test_Core { $object->teardown(); } + if ($e) { + throw $e; + } + + $this->stats[$class]['total']++; // Test passed -- cgit v1.2.3