From 81aead238bd5780e1f8e5fb2079ec9de83bcfcc3 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Thu, 1 Aug 2013 12:59:52 +0200 Subject: [PATCH] pass command name automatically if required by the application --- .../Component/Console/Tester/CommandTester.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Symfony/Component/Console/Tester/CommandTester.php b/src/Symfony/Component/Console/Tester/CommandTester.php index 53d301b849..705abf718f 100644 --- a/src/Symfony/Component/Console/Tester/CommandTester.php +++ b/src/Symfony/Component/Console/Tester/CommandTester.php @@ -55,6 +55,18 @@ class CommandTester */ 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']);