Skip to content

Commit

Permalink
[Console] pass command name automatically if required by the application
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Aug 9, 2013
1 parent b970d17 commit 50c8050
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Symfony/Component/Console/Tester/CommandTester.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down

0 comments on commit 50c8050

Please sign in to comment.