summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--application/controllers/tools.php20
-rw-r--r--application/errors/error_general.php7
2 files changed, 21 insertions, 6 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);
+ }
}
}
diff --git a/application/errors/error_general.php b/application/errors/error_general.php
index 87d5b62f6..925c7751f 100644
--- a/application/errors/error_general.php
+++ b/application/errors/error_general.php
@@ -33,8 +33,11 @@ if (class_exists("CI_Controller") && !isset($GLOBALS["is_error_page"])) {
<?php
include 'application/views/footer.php';
} elseif (php_sapi_name() === 'cli' OR defined('STDIN')) {
- echo "$heading\n";
- echo str_replace("<br>", "\n", $message);
+ echo "# $heading\n";
+ $msg = strip_tags(str_replace("<br>", "\n", $message));
+ foreach (explode("\n", $msg) as $line) {
+ echo "# $line\n";
+ }
} else {
// default CI error page
?>