diff --git a/src/Symfony/Component/Console/Command/Command.php b/src/Symfony/Component/Console/Command/Command.php index 29625a26da..f169b6eb87 100644 --- a/src/Symfony/Component/Console/Command/Command.php +++ b/src/Symfony/Component/Console/Command/Command.php @@ -484,7 +484,7 @@ class Command */ public function getHelp() { - return $this->help; + return $this->help ?: $this->description; } /** diff --git a/src/Symfony/Component/Console/Tests/Command/CommandTest.php b/src/Symfony/Component/Console/Tests/Command/CommandTest.php index 1ae12874ba..a0c8d78deb 100644 --- a/src/Symfony/Component/Console/Tests/Command/CommandTest.php +++ b/src/Symfony/Component/Console/Tests/Command/CommandTest.php @@ -131,6 +131,8 @@ class CommandTest extends \PHPUnit_Framework_TestCase $ret = $command->setHelp('help1'); $this->assertEquals($command, $ret, '->setHelp() implements a fluent interface'); $this->assertEquals('help1', $command->getHelp(), '->setHelp() sets the help'); + $command->setHelp(''); + $this->assertEquals('description', $command->getHelp(), '->getHelp() fallback to the description'); } public function testGetProcessedHelp() diff --git a/src/Symfony/Component/Console/Tests/Fixtures/application_asxml1.txt b/src/Symfony/Component/Console/Tests/Fixtures/application_asxml1.txt index 71d2fcba35..3652d6613d 100644 --- a/src/Symfony/Component/Console/Tests/Fixtures/application_asxml1.txt +++ b/src/Symfony/Component/Console/Tests/Fixtures/application_asxml1.txt @@ -97,7 +97,7 @@ foo:bar The foo:bar command - + The foo:bar command afoobar diff --git a/src/Symfony/Component/Console/Tests/Fixtures/application_asxml2.txt b/src/Symfony/Component/Console/Tests/Fixtures/application_asxml2.txt index 0b30b201f2..3205f9cb5f 100644 --- a/src/Symfony/Component/Console/Tests/Fixtures/application_asxml2.txt +++ b/src/Symfony/Component/Console/Tests/Fixtures/application_asxml2.txt @@ -4,7 +4,7 @@ foo:bar The foo:bar command - + The foo:bar command afoobar