public function nextPage($pages) { $response = $this->http_client->request('GET', $pages['next'], ['auth' => $this->getAuth(), 'headers' => ['Accept' => 'application/json']]); return $this->handleResponse($response); }
public function testPaginationHelper() { $mock = new MockHandler([new Response(200, ['X-Foo' => 'Bar'], "{\"foo\":\"bar\"}")]); $container = []; $history = Middleware::history($container); $stack = HandlerStack::create($mock); $stack->push($history); $http_client = new Client(['handler' => $stack]); $client = new IntercomClient('u', 'p'); $client->setClient($http_client); $client->nextPage(['next' => 'https://foo.com']); foreach ($container as $transaction) { $host = $transaction['request']->getUri()->getHost(); $this->assertTrue($host == "foo.com"); } }