diff --git a/src/Symfony/Component/Console/Tester/CommandTester.php b/src/Symfony/Component/Console/Tester/CommandTester.php index c84057400e6bf..415787b2a096e 100644 --- a/src/Symfony/Component/Console/Tester/CommandTester.php +++ b/src/Symfony/Component/Console/Tester/CommandTester.php @@ -52,6 +52,18 @@ public function __construct(Command $command) */ public function execute(array $input, array $options = array()) { + // set the command name automatically if the application requires + // this argument and no command name was passed + if (!isset($input['command'])) { + $application = $this->command->getApplication(); + if (null !== $application) { + $definition = $application->getDefinition(); + if ($definition->hasArgument('command')) { + $input['command'] = $this->command->getName(); + } + } + } + $this->input = new ArrayInput($input); if (isset($options['interactive'])) { $this->input->setInteractive($options['interactive']);