8000 use ->find instead of ->get in the help command to allow command alia… · sam57/symfony@6cbeff0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6cbeff0

Browse files
author
< 8000 span class="Box-sc-g0xbh4-0 PhXDz AuthorDisplayName-module__Text--dSylB prc-Text-Text-0ima0">Gunther Konig
committed
use ->find instead of ->get in the help command to allow command aliases to be used (e.g. "./app/console help do:sc:ge")
1 parent 496ed13 commit 6cbeff0

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/Symfony/Component/Console/Command/HelpCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function setCommand(Command $command)
7070
protected function execute(InputInterface $input, OutputInterface $output)
7171
{
7272
if (null === $this->command) {
73-
$this->command = $this->getApplication()->get($input->getArgument('command_name'));
73+
$this->command = $this->getApplication()->find($input->getArgument('command_name'));
7474
}
7575

7676
if ($input->getOption('xml')) {

src/Symfony/Component/Console/Tests/Command/HelpCommandTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ public function testExecute()
2222
{
2323
$command = new HelpCommand();
2424

25+
$application = new Application();
26+
$command->setApplication($application);
27+
$commandTester = new CommandTester($command);
28+
$commandTester->execute(array('command_name' => 'li'));
29+
$this->assertRegExp('/list \[--xml\] \[--raw\] \[namespace\]/', $commandTester->getDisplay(), '->execute() returns a text help for the given command alias');
30+
31+
$command = new HelpCommand();
32+
2533
$commandTester = new CommandTester($command);
2634
$command->setCommand(new ListCommand());
2735
$commandTester->execute(array());

0 commit comments

Comments
 (0)
0