/** * @param IInput $input * @param IConsole $console * * @return ICommand * @throws AmbiguousCommandException * @throws CommandNotFoundException */ protected function findCommand(IInput $input, IConsole $console) { if ($input->hasArgument('command')) { $matcher = new ArgumentsMatcher(new ArgumentsParser()); return $matcher->findCommand($console->getCommands(), $input->getArgument('command')); } return $input->getCommand(); }
function it_uses_self_as_command(IInput $input) { $console = new Console(); $input->hasArgument('command')->willReturn(false); $input->getCommand()->willReturn(new Command()); $output = new Output(); $output->setEnableBuffering(true); $this->run($input, $output, $console); }