TestShell passes the 'directive' option to PHPUnit correctly

This commit is contained in:
nojimage 2016-08-08 20:09:37 +09:00
parent 0a22058e35
commit e71d83c612
2 changed files with 24 additions and 1 deletions

View file

@ -152,6 +152,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 +235,11 @@ class TestShell extends Shell {
if ($value === false) {
continue;
}
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();
}
}