Merge pull request #9231 from nojimage/patch-testshell

Improve TestShell
This commit is contained in:
Mark Story 2016-08-08 09:21:03 -04:00 committed by GitHub
commit dd6191186e
2 changed files with 27 additions and 1 deletions

View file

@ -71,6 +71,9 @@ class TestShell extends Shell {
))->addOption('coverage-clover', array(
'help' => __d('cake_console', '<file> Write code coverage data in Clover XML format.'),
'default' => false
))->addOption('coverage-text', array(
'help' => __d('cake_console', 'Output code coverage report in Text format.'),
'boolean' => true
))->addOption('testdox-html', array(
'help' => __d('cake_console', '<file> Write agile documentation in HTML format to file.'),
'default' => false
@ -152,6 +155,7 @@ class TestShell extends Shell {
'default' => false
))->addOption('directive', array(
'help' => __d('cake_console', 'key[=value] Sets a php.ini value.'),
'short' => 'd',
'default' => false
))->addOption('fixture', array(
'help' => __d('cake_console', 'Choose a custom fixture manager.')
@ -234,7 +238,11 @@ class TestShell extends Shell {
if ($value === false) {
continue;
}
$options[] = '--' . $param;
if ($param === 'directive') {
$options[] = '-d';
} else {
$options[] = '--' . $param;
}
if (is_string($value)) {
$options[] = $value;
}

View file

@ -359,4 +359,22 @@ class TestShellTest extends CakeTestCase {
);
$this->Shell->main();
}
/**
* Tests that the '--directive' parameter change to '-d' before calling PHPUnit
*
* @return void
*/
public function testRunnerOptionsDirective() {
$this->Shell->startup();
$this->Shell->args = array('core', 'Basics');
$this->Shell->params = array('directive' => 'memory_limit=128M');
$this->Shell->expects($this->once())->method('_run')
->with(
array('app' => false, 'plugin' => null, 'core' => true, 'output' => 'text', 'case' => 'Basics'),
array('-d', 'memory_limit=128M', '--colors')
);
$this->Shell->main();
}
}