diff --git a/cake/console/libs/testsuite.php b/cake/console/libs/testsuite.php index 3d028afbb..d620f7c92 100644 --- a/cake/console/libs/testsuite.php +++ b/cake/console/libs/testsuite.php @@ -138,9 +138,15 @@ class TestSuiteShell extends Shell { if ($this->__canRun()) { $this->out('Running '.$this->category.' '.$this->type.' '.$this->file); - $this->__run(); + + $exitCode = 0; + if (!$this->__run()) { + $exitCode = 1; + } + exit($exitCode); } else { $this->err('Sorry, the tests could not be found.'); + exit(1); } } /** @@ -286,6 +292,7 @@ class TestSuiteShell extends Shell { require_once CAKE . 'tests' . DS . 'lib' . DS . 'code_coverage_manager.php'; CodeCoverageManager::start($case, $reporter); } + $result = TestManager::runTestCase($case, $reporter); if ($this->doCoverage) { CodeCoverageManager::report(); diff --git a/cake/tests/lib/cli_reporter.php b/cake/tests/lib/cli_reporter.php index f65c1c023..d5edb772b 100644 --- a/cake/tests/lib/cli_reporter.php +++ b/cake/tests/lib/cli_reporter.php @@ -30,10 +30,6 @@ define('ST_FAILDETAIL_SEPARATOR', "->"); } - if (! defined('ST_FAILS_RETURN_CODE')) { - define('ST_FAILS_RETURN_CODE', 1); - } - if (version_compare(phpversion(), '4.4.4', '<=') || php_sapi_name() == 'cgi') { define('STDOUT', fopen('php://stdout', 'w')); @@ -102,7 +98,6 @@ class CLIReporter extends TextReporter { } $buffer .= ".\n"; fwrite(STDOUT, $buffer); - exit(ST_FAILS_RETURN_CODE); } else { fwrite(STDOUT, $buffer . $this->getPassCount() . " passes.\n"); }