diff options
Diffstat (limited to 'modules/gallery_unit_test')
-rw-r--r-- | modules/gallery_unit_test/controllers/gallery_unit_test.php | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/modules/gallery_unit_test/controllers/gallery_unit_test.php b/modules/gallery_unit_test/controllers/gallery_unit_test.php index cf2f7c99..5dd086b9 100644 --- a/modules/gallery_unit_test/controllers/gallery_unit_test.php +++ b/modules/gallery_unit_test/controllers/gallery_unit_test.php @@ -27,9 +27,6 @@ class Gallery_Unit_Test_Controller extends Controller { ini_set("display_errors", true); error_reporting(-1); - // Track whether all tests pass so we can return an appropriate code to the CLI - $all_tests_passed = false; - // Jump through some hoops to satisfy the way that we check for the site_domain in // config.php. We structure this such that the code in config will leave us with a // site_domain of "." (for historical reasons) @@ -135,7 +132,8 @@ class Gallery_Unit_Test_Controller extends Controller { graphics::choose_default_toolkit(); $filter = count($_SERVER["argv"]) > 2 ? $_SERVER["argv"][2] : null; - print new Unit_Test($modules, $filter, $all_tests_passed); + $unit_test = new Unit_Test($modules, $filter); + print $unit_test; } catch (ORM_Validation_Exception $e) { print "Validation Exception: {$e->getMessage()}\n"; print $e->getTraceAsString() . "\n"; @@ -147,12 +145,12 @@ class Gallery_Unit_Test_Controller extends Controller { print $e->getTraceAsString() . "\n"; } - // Let the CLI caller know whether all tests passed or not, - // to allow usage of continuous integration servers. + $failed = 0; + foreach ($unit_test->stats as $class => $stats) { + $failed += $stats["failed"]; + } if (PHP_SAPI == 'cli') { - $exit_status = $all_tests_passed ? 0 : 1; - print "Exit: $exit_status\n"; - exit($exit_status); + exit($failed); } } } |