Creating a factory method for the runner creation.

This commit is contained in:
mark_story 2011-02-13 12:10:27 -05:00
parent 78dd89027d
commit 1c9808fdca

View file

@ -61,7 +61,7 @@ class CakeTestSuiteCommand extends PHPUnit_TextUI_Command {
public function run(array $argv, $exit = true) { public function run(array $argv, $exit = true) {
$this->handleArguments($argv); $this->handleArguments($argv);
$runner = new CakeTestRunner($this->arguments['loader'], $this->_params); $runner = $this->getRunner($this->arguments['loader']);
if (is_object($this->arguments['test']) && if (is_object($this->arguments['test']) &&
$this->arguments['test'] instanceof PHPUnit_Framework_Test) { $this->arguments['test'] instanceof PHPUnit_Framework_Test) {
@ -131,13 +131,23 @@ class CakeTestSuiteCommand extends PHPUnit_TextUI_Command {
} }
} }
/**
* Create a runner for the command.
*
* @param $loader The loader to be used for the test run.
* @return CakeTestRunner
*/
public function getRunner($loader) {
return new CakeTestRunner($loader, $this->_params);
}
/** /**
* Handler for customizing the FixtureManager class/ * Handler for customizing the FixtureManager class/
* *
* @param string $class Name of the class that will be the fixture manager * @param string $class Name of the class that will be the fixture manager
* @return void * @return void
*/ */
function handleFixture($class) { public function handleFixture($class) {
$this->arguments['fixtureManager'] = $class; $this->arguments['fixtureManager'] = $class;
} }