mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-05-19 19:09:13 -04:00
Make sure that we always run teardown, even when the test throws an exception
This commit is contained in:
@@ -140,8 +140,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)
|
||||
@@ -149,6 +153,11 @@ class Unit_Test_Core {
|
||||
$object->teardown();
|
||||
}
|
||||
|
||||
if ($e) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
|
||||
$this->stats[$class]['total']++;
|
||||
|
||||
// Test passed
|
||||
|
||||
Reference in New Issue
Block a user