/** * Execute the command. * * @throws \RuntimeException on command error. * * @param string[] $arguments * * @return CommandResultInterface */ public function execute(array $arguments = array()) { $this->arguments[] = $arguments; $command = $this->builder->addArguments($arguments)->buildCommand(); $result = $command->runSynchronous(); if (0 !== $result->getExitCode()) { // TODO: Better exception type? throw new \RuntimeException($result->getStdErr(), $result->getExitCode()); } return $result; }
public function testTooFewReturns() { $this->setExpectedException('\\RuntimeException', 'No result was provided for use when mocking execution of the command.'); $builder = new MockCommandBuilder(); $builder->setCommand('foo')->addArgument('--test')->buildCommand(); }