コード例 #1
0
ファイル: RunnerTest.php プロジェクト: theseer/cli
 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());
 }
コード例 #2
0
 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);
     }
 }
コード例 #3
0
 /**
  * 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;
         }
     }
 }
コード例 #4
0
ファイル: bug48409.php プロジェクト: badlamer/hhvm
{
    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');
}
コード例 #5
0
 /**
  * @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);
 }
コード例 #6
0
 /**
  * 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();
 }
コード例 #7
0
ファイル: SlimRestful.php プロジェクト: m4nolo/slim-restful
 public function run()
 {
     $runner = new Runner();
     $runner->run($this);
 }