$input =
new ArrayInput(['--foo'
]);
$this->
assertTrue($input->
hasParameterOption('--foo'
), '->hasParameterOption() returns true if an option is present in the passed parameters'
);
$input =
new ArrayInput(['--foo', '--', '--bar'
]);
$this->
assertTrue($input->
hasParameterOption('--bar'
), '->hasParameterOption() returns true if an option is present in the passed parameters'
);
$this->
assertFalse($input->
hasParameterOption('--bar', true
), '->hasParameterOption() returns false if an option is present in the passed parameters after an end of options signal'
);
} public function testGetParameterOption() { $input =
new ArrayInput(['name' => 'Fabien', '--foo' => 'bar'
]);
$this->
assertEquals('bar',
$input->
getParameterOption('--foo'
), '->getParameterOption() returns the option of specified name'
);
$this->
assertEquals('default',
$input->
getParameterOption('--bar', 'default'
), '->getParameterOption() returns the default value if an option is not present in the passed parameters'
);
$input =
new ArrayInput(['Fabien', '--foo' => 'bar'
]);
$this->
assertEquals('bar',
$input->
getParameterOption('--foo'
), '->getParameterOption() returns the option of specified name'
);
$input =
new ArrayInput(['--foo', '--', '--bar' => 'woop'
]);
$this->
assertEquals('woop',
$input->
getParameterOption('--bar'
), '->getParameterOption() returns the correct value if an option is present in the passed parameters'
);
$this->
assertEquals('default',
$input->
getParameterOption('--bar', 'default', true
), '->getParameterOption() returns the default value if an option is present in the passed parameters after an end of options signal'
);
} public function testParseArguments() {