merged branch geecu/help_command_find (PR #5558)

Commits
-------

6cbeff0 use ->find instead of ->get in the help command to allow command aliases to be used (e.g. "./app/console help do:sc:ge")

Discussion
----------

use ->find instead of ->get in the help command to allow command aliases...

... to be used (e.g. "./app/console help do:sc:ge")
This commit is contained in:
Fabien Potencier 2012-09-20 10:37:29 +02:00
commit a7b7314abd
2 changed files with 9 additions and 1 deletions

View File

@ -70,7 +70,7 @@ EOF
protected function execute(InputInterface $input, OutputInterface $output)
{
if (null === $this->command) {
$this->command = $this->getApplication()->get($input->getArgument('command_name'));
$this->command = $this->getApplication()->find($input->getArgument('command_name'));
}
if ($input->getOption('xml')) {

View File

@ -22,6 +22,14 @@ class HelpCommandTest extends \PHPUnit_Framework_TestCase
{
$command = new HelpCommand();
$application = new Application();
$command->setApplication($application);
$commandTester = new CommandTester($command);
$commandTester->execute(array('command_name' => 'li'));
$this->assertRegExp('/list \[--xml\] \[--raw\] \[namespace\]/', $commandTester->getDisplay(), '->execute() returns a text help for the given command alias');
$command = new HelpCommand();
$commandTester = new CommandTester($command);
$command->setCommand(new ListCommand());
$commandTester->execute(array());