[Console] Fixed invalid help command shortcut

This commit is contained in:
Fabien Pennequin 2010-07-17 12:54:14 +02:00 committed by Fabien Potencier
parent a86bac44ce
commit 56935f85df
2 changed files with 7 additions and 1 deletions

View File

@ -147,7 +147,7 @@ class Application
$output->setDecorated(true);
}
if (true === $input->hasParameterOption(array('--help', '-H'))) {
if (true === $input->hasParameterOption(array('--help', '-h'))) {
if (!$name) {
$name = 'help';
$input = new ArrayInput(array('command' => 'help'));

View File

@ -267,6 +267,9 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
$tester->run(array('--help' => true));
$this->assertStringEqualsFile(self::$fixturesPath.'/application_run2.txt', $tester->getDisplay(), '->run() runs the help command if --help is passed');
$tester->run(array('-h' => true));
$this->assertStringEqualsFile(self::$fixturesPath.'/application_run2.txt', $tester->getDisplay(), '->run() runs the help command if -h is passed');
$application = new Application();
$application->setAutoExit(false);
$application->setCatchExceptions(false);
@ -274,6 +277,9 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
$tester->run(array('command' => 'list', '--help' => true));
$this->assertStringEqualsFile(self::$fixturesPath.'/application_run3.txt', $tester->getDisplay(), '->run() displays the help if --help is passed');
$tester->run(array('command' => 'list', '-h' => true));
$this->assertStringEqualsFile(self::$fixturesPath.'/application_run3.txt', $tester->getDisplay(), '->run() displays the help if -h is passed');
$application = new Application();
$application->setAutoExit(false);
$application->setCatchExceptions(false);