merged branch Nanocom/master (PR #4609)
Commits -------60d371b
InputDefinition: Fixed unit testsc099763
InputDefinition: corrected grammar mistakes and added a @throws declaration Discussion ---------- [Console] InputDefinition: corrected grammar mistakes and added a missing @throws declaration --------------------------------------------------------------------------- by travisbot at 2012-06-18T21:46:59Z This pull request [fails](http://travis-ci.org/symfony/symfony/builds/1650681) (mergedc0997634
into086ff482
). --------------------------------------------------------------------------- by Nanocom at 2012-06-18T21:58:32Z Wooops, forgot to change unit tests :) Doing this right now --------------------------------------------------------------------------- by travisbot at 2012-06-18T22:18:42Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1650917) (merged60d371bc
into086ff482
).
This commit is contained in:
commit
363d3823de
@ -113,7 +113,7 @@ class InputDefinition
|
|||||||
public function addArgument(InputArgument $argument)
|
public function addArgument(InputArgument $argument)
|
||||||
{
|
{
|
||||||
if (isset($this->arguments[$argument->getName()])) {
|
if (isset($this->arguments[$argument->getName()])) {
|
||||||
throw new \LogicException(sprintf('An argument with name "%s" already exist.', $argument->getName()));
|
throw new \LogicException(sprintf('An argument with name "%s" already exists.', $argument->getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->hasAnArrayArgument) {
|
if ($this->hasAnArrayArgument) {
|
||||||
@ -262,9 +262,9 @@ class InputDefinition
|
|||||||
public function addOption(InputOption $option)
|
public function addOption(InputOption $option)
|
||||||
{
|
{
|
||||||
if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
|
if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
|
||||||
throw new \LogicException(sprintf('An option named "%s" already exist.', $option->getName()));
|
throw new \LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
|
||||||
} elseif (isset($this->shortcuts[$option->getShortcut()]) && !$option->equals($this->options[$this->shortcuts[$option->getShortcut()]])) {
|
} elseif (isset($this->shortcuts[$option->getShortcut()]) && !$option->equals($this->options[$this->shortcuts[$option->getShortcut()]])) {
|
||||||
throw new \LogicException(sprintf('An option with shortcut "%s" already exist.', $option->getShortcut()));
|
throw new \LogicException(sprintf('An option with shortcut "%s" already exists.', $option->getShortcut()));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->options[$option->getName()] = $option;
|
$this->options[$option->getName()] = $option;
|
||||||
@ -280,6 +280,8 @@ class InputDefinition
|
|||||||
*
|
*
|
||||||
* @return InputOption A InputOption object
|
* @return InputOption A InputOption object
|
||||||
*
|
*
|
||||||
|
* @throws \InvalidArgumentException When option given doesn't exist
|
||||||
|
*
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
public function getOption($name)
|
public function getOption($name)
|
||||||
|
@ -84,7 +84,7 @@ class InputDefinitionTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->fail('->addArgument() throws a Exception if another argument is already registered with the same name');
|
$this->fail('->addArgument() throws a Exception if another argument is already registered with the same name');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->assertInstanceOf('\Exception', $e, '->addArgument() throws a Exception if another argument is already registered with the same name');
|
$this->assertInstanceOf('\Exception', $e, '->addArgument() throws a Exception if another argument is already registered with the same name');
|
||||||
$this->assertEquals('An argument with name "foo" already exist.', $e->getMessage());
|
$this->assertEquals('An argument with name "foo" already exists.', $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
// cannot add a parameter after an array parameter
|
// cannot add a parameter after an array parameter
|
||||||
@ -215,14 +215,14 @@ class InputDefinitionTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->fail('->addOption() throws a Exception if the another option is already registered with the same name');
|
$this->fail('->addOption() throws a Exception if the another option is already registered with the same name');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->assertInstanceOf('\Exception', $e, '->addOption() throws a Exception if the another option is already registered with the same name');
|
$this->assertInstanceOf('\Exception', $e, '->addOption() throws a Exception if the another option is already registered with the same name');
|
||||||
$this->assertEquals('An option named "foo" already exist.', $e->getMessage());
|
$this->assertEquals('An option named "foo" already exists.', $e->getMessage());
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$definition->addOption($this->foo1);
|
$definition->addOption($this->foo1);
|
||||||
$this->fail('->addOption() throws a Exception if the another option is already registered with the same shortcut');
|
$this->fail('->addOption() throws a Exception if the another option is already registered with the same shortcut');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->assertInstanceOf('\Exception', $e, '->addOption() throws a Exception if the another option is already registered with the same shortcut');
|
$this->assertInstanceOf('\Exception', $e, '->addOption() throws a Exception if the another option is already registered with the same shortcut');
|
||||||
$this->assertEquals('An option with shortcut "f" already exist.', $e->getMessage());
|
$this->assertEquals('An option with shortcut "f" already exists.', $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user