merged branch Nanocom/master (PR #4609)

Commits
-------

60d371b InputDefinition: Fixed unit tests
c099763 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) (merged c0997634 into 086ff482).

---------------------------------------------------------------------------

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) (merged 60d371bc into 086ff482).
This commit is contained in:
Fabien Potencier 2012-06-19 09:02:20 +02:00
commit 363d3823de
2 changed files with 8 additions and 6 deletions

View File

@ -113,7 +113,7 @@ class InputDefinition
public function addArgument(InputArgument $argument)
{
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) {
@ -262,9 +262,9 @@ class InputDefinition
public function addOption(InputOption $option)
{
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()]])) {
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;
@ -280,6 +280,8 @@ class InputDefinition
*
* @return InputOption A InputOption object
*
* @throws \InvalidArgumentException When option given doesn't exist
*
* @api
*/
public function getOption($name)

View File

@ -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');
} catch (\Exception $e) {
$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
@ -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');
} catch (\Exception $e) {
$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 {
$definition->addOption($this->foo1);
$this->fail('->addOption() throws a Exception if the another option is already registered with the same shortcut');
} catch (\Exception $e) {
$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());
}
}