public function testUnknownCommandExceptionsReportToStdErr() { $request = new Request(['help']); $locator = $this->prophesize(CommandLocator::class); $locator->getCommandForRequest($request)->willThrow(new CommandLocatorException('...', CommandLocatorException::UnknownCommand)); $cli = new Runner($locator->reveal()); StdErrCapture::init(); $cli->run($request); StdErrCapture::done(); $this->assertEquals("Unknown command 'help'\n\n", StdErrCapture::getBuffer()); }
public function testLogJUnitCreatesXmlFile() { $outputPath = FIXTURES . DS . 'logs' . DS . 'test-output.xml'; $this->options['log-junit'] = $outputPath; $runner = new Runner($this->options); ob_start(); $runner->run(); ob_end_clean(); $this->assertTrue(file_exists($outputPath)); $this->assertJunitXmlIsCorrect($outputPath); if (file_exists($outputPath)) { unlink($outputPath); } }
/** * Run * * @access public */ public function run() { $pid = pcntl_fork(); while (true) { if ($pid == -1) { die('Could not fork'); } elseif ($pid) { // Parent pcntl_waitpid($pid, $status); sleep(5); $pid = pcntl_fork(); } else { // Child $trans = new Runner(); $trans->run(); exit; } } }
{ public function func() { $b = new BBB(); $c = new CCC(); $i = 34; $item = array('foo' => 'bar'); try { $c->process($b->xyz($item['foo'], $i)); } catch (ABCException $e) { $b->xyz($item['foo'], $i); } } } class Runner { public function run($x) { try { $x->func(); } catch (ABCException $e) { throw new Exception(); } } } try { $runner = new Runner(); $runner->run(new AAA()); } catch (Exception $e) { die('Exception thrown'); }
/** * @param Questioner $questioner * @param Runner $runner * @param array $cachedAnswers Cached answers (from a previous run) */ public function execute(Questioner $questioner, Runner $runner, array $cachedAnswers = []) { $answers = $questioner->interact($this->configurators, $runner->skipOptional(), $this->variables, [] !== $cachedAnswers ? $cachedAnswers : $this->defaults); $runner->run($this, $this->generators, $answers); }
/** * Executes a Request and (if applicable) automatically retries * when errors occur. * * @param Client $client * @param Request $req * @return array decoded result * @throws Exception on server side error (ie: not authenticated, * invalid or malformed post body, invalid url) */ public static function execute(Client $client, Request $req) { $runner = new Runner($client, sprintf('%s %s', $req->getRequestMethod(), $req->getUrl()), array(get_class(), 'doExecute'), array($client, $req)); return $runner->run(); }
public function run() { $runner = new Runner(); $runner->run($this); }