public function testAddRequests() { $requests = [new Request('url1', 'body1'), new Request('url2', 'body2')]; $batchRequest = new BatchRequest(); $batchRequest->addRequests($requests); $this->assertSame($requests, $batchRequest->getRequests()); }
/** * @inheritdoc */ public function sendBatch(BatchRequest $batchRequest) : array { $requests = array_map([$this, 'createRequest'], $batchRequest->getRequests()); $batchResults = Pool::batch($this->guzzleClient, $requests); if ($batchResults->getFailures()) { throw new BatchRequestFailureException($batchRequest, $batchResults); } return $batchResults->getSuccessful(); }