merged branch Nanocom/master (PR #4346)

Commits
-------

2c19b3c Empty shortcut check in the constructor
cf9039e Added a unit test for the shortcut name of the InputOption class

Discussion
----------

[Console] Single dash for option shortcuts

See https://github.com/symfony/symfony/pull/4062

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

by travisbot at 2012-05-20T13:09:18Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1380389) (merged 02290da4 into f433f6b0).

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

by stof at 2012-05-20T13:16:34Z

please rebase your branch to get rid of these merge commits
btw, you should use feature branches to send your next pull requests instead of using your master branch each time, which limits you to a single PR.

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

by Nanocom at 2012-05-20T13:39:32Z

Sorry for the mess, cleaning it

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

by travisbot at 2012-05-20T13:41:46Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1380549) (merged 63129657 into f433f6b0).

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

by travisbot at 2012-05-20T13:43:07Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1380553) (merged 2c19b3c7 into f433f6b0).
This commit is contained in:
Fabien Potencier 2012-05-22 12:30:31 +02:00
commit c1e868f994
2 changed files with 8 additions and 0 deletions

View File

@ -58,6 +58,10 @@ class InputOption
if ('-' === $shortcut[0]) {
$shortcut = substr($shortcut, 1);
}
if (empty($shortcut)) {
$shortcut = null;
}
}
if (null === $mode) {

View File

@ -35,6 +35,10 @@ class InputOptionTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('f', $option->getShortcut(), '__construct() can take a shortcut as its second argument');
$option = new InputOption('foo', '-f');
$this->assertEquals('f', $option->getShortcut(), '__construct() removes the leading - of the shortcut');
$option = new InputOption('foo');
$this->assertNull($option->getShortcut(), '__construct() makes the shortcut null by default');
$option = new InputOption('foo', '-');
$this->assertNull($option->getShortcut(), '__construct() makes the shortcut null if a single dash is specified as its name');
// mode argument
$option = new InputOption('foo', 'f');