From 56935f85dfa9aaf1e747dda939823ec0512ae0cd Mon Sep 17 00:00:00 2001 From: Fabien Pennequin Date: Sat, 17 Jul 2010 12:54:14 +0200 Subject: [PATCH] [Console] Fixed invalid help command shortcut --- src/Symfony/Component/Console/Application.php | 2 +- tests/Symfony/Tests/Component/Console/ApplicationTest.php | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index 1e3935d9af..6da8a577b0 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -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')); diff --git a/tests/Symfony/Tests/Component/Console/ApplicationTest.php b/tests/Symfony/Tests/Component/Console/ApplicationTest.php index bdfce97358..e028add388 100644 --- a/tests/Symfony/Tests/Component/Console/ApplicationTest.php +++ b/tests/Symfony/Tests/Component/Console/ApplicationTest.php @@ -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);