merged branch Nanocom/master (PR #4346)
Commits -------2c19b3c
Empty shortcut check in the constructorcf9039e
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 intof433f6b0
). --------------------------------------------------------------------------- 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 intof433f6b0
). --------------------------------------------------------------------------- by travisbot at 2012-05-20T13:43:07Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1380553) (merged2c19b3c7
intof433f6b0
).
This commit is contained in:
commit
c1e868f994
@ -58,6 +58,10 @@ class InputOption
|
|||||||
if ('-' === $shortcut[0]) {
|
if ('-' === $shortcut[0]) {
|
||||||
$shortcut = substr($shortcut, 1);
|
$shortcut = substr($shortcut, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($shortcut)) {
|
||||||
|
$shortcut = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null === $mode) {
|
if (null === $mode) {
|
||||||
|
@ -35,6 +35,10 @@ class InputOptionTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals('f', $option->getShortcut(), '__construct() can take a shortcut as its second argument');
|
$this->assertEquals('f', $option->getShortcut(), '__construct() can take a shortcut as its second argument');
|
||||||
$option = new InputOption('foo', '-f');
|
$option = new InputOption('foo', '-f');
|
||||||
$this->assertEquals('f', $option->getShortcut(), '__construct() removes the leading - of the shortcut');
|
$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
|
// mode argument
|
||||||
$option = new InputOption('foo', 'f');
|
$option = new InputOption('foo', 'f');
|
||||||
|
Reference in New Issue
Block a user