summaryrefslogtreecommitdiffstats
path: root/application/controllers
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2015-03-08 21:06:39 +0100
committerFlorian Pritz <bluewind@xinu.at>2015-03-08 21:06:39 +0100
commit4d1e08883ddd55ad7ad56d25b8c1b83ab7d31838 (patch)
tree047bc95d129507b5221428a70bf8658f195c5d35 /application/controllers
parent843524be0f8b988f38bcbe28b4acceee2b9199d5 (diff)
Test: Improve exception handling
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/controllers')
-rw-r--r--application/controllers/tools.php20
1 files changed, 16 insertions, 4 deletions
diff --git a/application/controllers/tools.php b/application/controllers/tools.php
index e226b1815..7c8538cfb 100644
--- a/application/controllers/tools.php
+++ b/application/controllers/tools.php
@@ -74,14 +74,26 @@ class Tools extends MY_Controller {
$test = new $testclass();
$test->setServer($url);
+ $exitcode = 0;
+
$refl = new ReflectionClass($test);
foreach ($refl->getMethods() as $method) {
if (strpos($method->name, "test_") === 0) {
- $test->init();
- $test->{$method->name}();
- $test->cleanup();
+ try {
+ $test->init();
+ $test->{$method->name}();
+ $test->cleanup();
+ } catch (\Exception $e) {
+ echo "not ok - uncaught exception in $testcase->$method->name\n";
+ _actual_exception_handler($e);
+ $exitcode = 255;
+ }
}
}
- $test->done_testing();
+ if ($exitcode == 0) {
+ $test->done_testing();
+ } else {
+ exit($exitcode);
+ }
}
}