public function testImplements()
 {
     $exception = new BatchRequestException();
     $this->assertEquals('At least one request is failed', $exception->getMessage());
     $this->assertAttributeEquals(null, 'results', $exception);
     $this->assertEquals(null, $exception->getResults());
     $results = ['value' => 1];
     $exception->setResults($results);
     $this->assertAttributeEquals($results, 'results', $exception);
     $this->assertEquals($results, $exception->getResults());
 }
示例#2
0
 /**
  * execute batch requests (post).
  *
  * @throws BatchRequestException
  *
  * @return Models\Responses\OrtcResponse
  */
 public function batchExecute()
 {
     $guzzleRequests = $this->createBatchPostRequests();
     $results = Pool::batch($this->guzzleClient, $guzzleRequests, ['pool_size' => $this->request->getOrtcConfig()->getBatchPoolSize()]);
     if (count($results->getFailures()) > 0) {
         $batchRequestException = new BatchRequestException();
         $batchRequestException->setResults($results);
         throw $batchRequestException;
     }
     $handler = $this->request->getResponseHandler();
     return $handler->handle($results);
 }