소스 검색

[Console] fixed help command when used from the shell (closes #3480)

Fabien Potencier 13 년 전
부모
커밋
8fe6ee3d62
2개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 0
      src/Symfony/Component/Console/Command/HelpCommand.php
  2. 2 1
      tests/Symfony/Tests/Component/Console/Command/HelpCommandTest.php

+ 2 - 0
src/Symfony/Component/Console/Command/HelpCommand.php

@@ -77,5 +77,7 @@ EOF
         } else {
             $output->writeln($this->command->asText());
         }
+
+        $this->command = null;
     }
 }

+ 2 - 1
tests/Symfony/Tests/Component/Console/Command/HelpCommandTest.php

@@ -21,12 +21,13 @@ class HelpCommandTest extends \PHPUnit_Framework_TestCase
     public function testExecute()
     {
         $command = new HelpCommand();
-        $command->setCommand(new ListCommand());
 
         $commandTester = new CommandTester($command);
+        $command->setCommand(new ListCommand());
         $commandTester->execute(array());
         $this->assertRegExp('/list \[--xml\] \[namespace\]/', $commandTester->getDisplay(), '->execute() returns a text help for the given command');
 
+        $command->setCommand(new ListCommand());
         $commandTester->execute(array('--xml' => true));
         $this->assertRegExp('/<command/', $commandTester->getDisplay(), '->execute() returns an XML help text if --xml is passed');