[Console] do not make the getHelp() method smart
This commit is contained in:
parent
3765d8a01d
commit
cdf1f00ed1
@ -491,7 +491,7 @@ class Command
|
||||
*/
|
||||
public function getHelp()
|
||||
{
|
||||
return $this->help ?: $this->description;
|
||||
return $this->help;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -513,7 +513,7 @@ class Command
|
||||
$_SERVER['PHP_SELF'].' '.$name,
|
||||
);
|
||||
|
||||
return str_replace($placeholders, $replacements, $this->getHelp());
|
||||
return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -132,7 +132,7 @@ class CommandTest extends \PHPUnit_Framework_TestCase
|
||||
$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');
|
||||
$this->assertEquals('', $command->getHelp(), '->getHelp() does not fall back to the description');
|
||||
}
|
||||
|
||||
public function testGetProcessedHelp()
|
||||
@ -141,6 +141,10 @@ class CommandTest extends \PHPUnit_Framework_TestCase
|
||||
$command->setHelp('The %command.name% command does... Example: php %command.full_name%.');
|
||||
$this->assertContains('The namespace:name command does...', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.name% correctly');
|
||||
$this->assertNotContains('%command.full_name%', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.full_name%');
|
||||
|
||||
$command = new \TestCommand();
|
||||
$command->setHelp('');
|
||||
$this->assertContains('description', $command->getProcessedHelp(), '->getProcessedHelp() falls back to the description');
|
||||
}
|
||||
|
||||
public function testGetSetAliases()
|
||||
|
Reference in New Issue
Block a user