diff options
author | Bharat Mediratta <bharat@menalto.com> | 2013-03-06 16:45:38 -0500 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2013-03-06 16:45:38 -0500 |
commit | f0064643c20d66a4b4abb3b6450afe6c48e27da1 (patch) | |
tree | e4e58d5c2b0d6f7cfc07c5dc9802fc7e443a8894 | |
parent | feed100337e2222c4656901d11c2f80a0e667002 (diff) |
Set exit status to the number of failed tests. This should fix issues with Travis.
-rw-r--r-- | modules/gallery_unit_test/controllers/gallery_unit_test.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/modules/gallery_unit_test/controllers/gallery_unit_test.php b/modules/gallery_unit_test/controllers/gallery_unit_test.php index 67d006b3..5dd086b9 100644 --- a/modules/gallery_unit_test/controllers/gallery_unit_test.php +++ b/modules/gallery_unit_test/controllers/gallery_unit_test.php @@ -132,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); + $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"; @@ -143,5 +144,13 @@ class Gallery_Unit_Test_Controller extends Controller { print "Exception: {$e->getMessage()}\n"; print $e->getTraceAsString() . "\n"; } + + $failed = 0; + foreach ($unit_test->stats as $class => $stats) { + $failed += $stats["failed"]; + } + if (PHP_SAPI == 'cli') { + exit($failed); + } } } |