protected function execute(InputInterface $input, OutputInterface $output) { $inputParameters = array('--no-tty' => false); if ($input->getOption('no-tty')) { $inputParameters['--no-tty'] = $input->getOption('no-tty'); } $uniqueId = uniqid($this->getName() . ':'); $inputParameters['command'] = $uniqueId; foreach ($this->allowedCommands as $allowedCommand) { if ($input->getOption($allowedCommand)) { $this->scriptOptions['command'] = $allowedCommand; } } $script = $this->scriptBuilder->build($this->scriptOptions); $command = new ScriptCommand($uniqueId, $script); $command->setApplication($this->getApplication()); $exitCode = $command->run(new ArrayInput($inputParameters), $output); return $exitCode; }
public function it_should_return_script_prefixed_by_echo(Builder $builder) { $builder->build(array('test'))->willReturn('test'); $this->build(array('test'))->shouldBeLike('echo test'); }
/** * @param array $options * * @return string */ public function build(array $options) { return 'echo ' . $this->builder->build($options); }