public function testLoadNextBuys() { /** @var \PHPUnit_Framework_MockObject_MockObject|ResourceCollection $buys */ $buys = $this->getMock(ResourceCollection::class); $response = $this->getMock(ResponseInterface::class); $nextPage = new ResourceCollection(); $buys->expects($this->any())->method('getNextUri')->willReturn('/test/next/uri'); $this->http->expects($this->any())->method('get')->with('/test/next/uri', ['foo' => 'bar'])->willReturn($response); $this->mapper->expects($this->any())->method('toBuys')->willReturn($nextPage); $buys->expects($this->once())->method('mergeNextPage')->with($nextPage); $this->client->loadNextBuys($buys, ['foo' => 'bar']); }