merged branch pgodel/bugfix/InputOption (PR #5905)

This PR was merged into the 2.0 branch.

Commits
-------

762649f shows correct class name InputOption in error message

Discussion
----------

[Console] shows correct class name InputOption in error message

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
License of the code: MIT

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

by pborreli at 2012-11-04T03:59:58Z

👍
This commit is contained in:
Fabien Potencier 2012-11-04 09:26:55 +01:00
commit e1c031f166
2 changed files with 2 additions and 2 deletions

View File

@ -148,7 +148,7 @@ class InputOption
public function setDefault($default = null)
{
if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) {
throw new \LogicException('Cannot set a default value when using Option::VALUE_NONE mode.');
throw new \LogicException('Cannot set a default value when using InputOption::VALUE_NONE mode.');
}
if ($this->isArray()) {

View File

@ -121,7 +121,7 @@ class InputOptionTest extends \PHPUnit_Framework_TestCase
$this->fail('->setDefault() throws an Exception if you give a default value for a VALUE_NONE option');
} catch (\Exception $e) {
$this->assertInstanceOf('\Exception', $e, '->setDefault() throws an Exception if you give a default value for a VALUE_NONE option');
$this->assertEquals('Cannot set a default value when using Option::VALUE_NONE mode.', $e->getMessage());
$this->assertEquals('Cannot set a default value when using InputOption::VALUE_NONE mode.', $e->getMessage());
}
$option = new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY);