Skip to content

Commit

Permalink
use ->find instead of ->get in the help command to allow command alia…
Browse files Browse the repository at this point in the history
…ses to be used (e.g. "./app/console help do:sc:ge")
  • Loading branch information
Gunther Konig committed Sep 20, 2012
1 parent 496ed13 commit 6cbeff0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Symfony/Component/Console/Command/HelpCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function setCommand(Command $command)
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')) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ public function testExecute()
{
$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());
Expand Down

0 comments on commit 6cbeff0

Please sign in to comment.