/** * For paged response fetch next result * * @return \Zuora\Response */ public function nextPage() { $data = $this->response->getData(); if (isset($data['nextPage'])) { if (false !== strpos($data['nextPage'], $this->client->getEnvironment()->getUrl(''))) { $url = substr($data['nextPage'], strlen($this->client->getEnvironment()->getUrl(''))); $url = parse_url($url); $path = $url['path']; parse_str($url['query'], $query); return $this->client->request($path, 'GET', $query); } } return null; }
public function testResponseException() { $response = new Response(); $response->setData('test'); $exception = new ResponseException($response); $this->assertEquals($response->getData(), $exception->getData()); // Test default stack trace $this->assertContains('Stack trace', $exception->__toString()); // HTTP code $response->setCode(400); $this->assertEquals($exception->__toString(), '400'); $response->setCode(0); // cURL code $response->setErrorCode(68); $this->assertEquals($exception->__toString(), '(68)'); $response->setErrorCode(0); // cURL message $response->setErrorMessage('remote host timed out'); $this->assertContains($response->getErrorMessage(), $exception->__toString()); $this->assertContains($response->getErrorMessage(), $exception->getMessageFromResponse()); }