Fixing tab/spaces.

This commit is contained in:
mark_story 2011-02-12 17:39:42 -05:00
parent 8c2e0815ec
commit 8ebbccbd76

View file

@ -52,82 +52,84 @@ class CakeTestSuiteCommand extends PHPUnit_TextUI_Command {
}
/**
* @param array $argv
* @param boolean $exit
*/
public function run(array $argv, $exit = TRUE)
{
$this->handleArguments($argv);
* Ugly hack to get around PHPUnit having a hard coded classname for the Runner. :(
*
* @param array $argv
* @param boolean $exit
*/
public function run(array $argv, $exit = TRUE)
{
$this->handleArguments($argv);
$runner = new CakeTestRunner($this->arguments['loader']);
$runner = new CakeTestRunner($this->arguments['loader']);
if (is_object($this->arguments['test']) &&
$this->arguments['test'] instanceof PHPUnit_Framework_Test) {
$suite = $this->arguments['test'];
} else {
$suite = $runner->getTest(
$this->arguments['test'],
$this->arguments['testFile'],
$this->arguments['syntaxCheck']
);
}
if (is_object($this->arguments['test']) &&
$this->arguments['test'] instanceof PHPUnit_Framework_Test) {
$suite = $this->arguments['test'];
} else {
$suite = $runner->getTest(
$this->arguments['test'],
$this->arguments['testFile'],
$this->arguments['syntaxCheck']
);
}
if (count($suite) == 0) {
$skeleton = new PHPUnit_Util_Skeleton_Test(
$suite->getName(),
$this->arguments['testFile']
);
if (count($suite) == 0) {
$skeleton = new PHPUnit_Util_Skeleton_Test(
$suite->getName(),
$this->arguments['testFile']
);
$result = $skeleton->generate(TRUE);
$result = $skeleton->generate(TRUE);
if (!$result['incomplete']) {
eval(str_replace(array('<?php', '?>'), '', $result['code']));
$suite = new PHPUnit_Framework_TestSuite(
$this->arguments['test'] . 'Test'
);
}
}
if (!$result['incomplete']) {
eval(str_replace(array('<?php', '?>'), '', $result['code']));
$suite = new PHPUnit_Framework_TestSuite(
$this->arguments['test'] . 'Test'
);
}
}
if ($this->arguments['listGroups']) {
PHPUnit_TextUI_TestRunner::printVersionString();
if ($this->arguments['listGroups']) {
PHPUnit_TextUI_TestRunner::printVersionString();
print "Available test group(s):\n";
print "Available test group(s):\n";
$groups = $suite->getGroups();
sort($groups);
$groups = $suite->getGroups();
sort($groups);
foreach ($groups as $group) {
print " - $group\n";
}
foreach ($groups as $group) {
print " - $group\n";
}
exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
}
exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
}
unset($this->arguments['test']);
unset($this->arguments['testFile']);
unset($this->arguments['test']);
unset($this->arguments['testFile']);
try {
$result = $runner->doRun($suite, $this->arguments);
}
try {
$result = $runner->doRun($suite, $this->arguments);
}
catch (PHPUnit_Framework_Exception $e) {
print $e->getMessage() . "\n";
}
catch (PHPUnit_Framework_Exception $e) {
print $e->getMessage() . "\n";
}
if ($exit) {
if (isset($result) && $result->wasSuccessful()) {
exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
}
if ($exit) {
if (isset($result) && $result->wasSuccessful()) {
exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
}
else if (!isset($result) || $result->errorCount() > 0) {
exit(PHPUnit_TextUI_TestRunner::EXCEPTION_EXIT);
}
else if (!isset($result) || $result->errorCount() > 0) {
exit(PHPUnit_TextUI_TestRunner::EXCEPTION_EXIT);
}
else {
exit(PHPUnit_TextUI_TestRunner::FAILURE_EXIT);
}
}
}
else {
exit(PHPUnit_TextUI_TestRunner::FAILURE_EXIT);
}
}
}
/**
* Handler for customizing the FixtureManager class/