adding CLI exit code to testsuite shell

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6899 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
DarkAngelBGE 2008-05-16 08:00:46 +00:00
parent d9a7170808
commit e42076b9c2
2 changed files with 8 additions and 6 deletions

View file

@ -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();

View file

@ -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");
}