public function testRequestParamReset()
 {
     $response = $this->createResponseChainMock(1);
     $cursor = new Cursor($response, $this->objectPrototype);
     $params = $cursor->getLastResponse()->getRequest()->getQueryParams();
     $params->offsetSet('offset', $this->getUniquePageId());
     $cursor->fetchAfter();
     $params2 = $cursor->getLastResponse()->getRequest()->getQueryParams();
     $this->assertNotEquals($params->offsetGet('offset'), $params2->offsetGet('offset'));
 }
 public function testExportability()
 {
     $response = $this->createResponseChainMock(1);
     $cursor = new Cursor($response, $this->objectPrototype);
     $array_copy = $cursor->getArrayCopy();
     $this->assertTrue(is_array($array_copy));
     $this->assertEquals($cursor->getArrayCopy(), $cursor->getObjects());
     $this->assertEquals(count($array_copy), count($response->getContent()['data']));
     foreach ($array_copy as $object) {
         if (!$object instanceof AbstractObject) {
             $this->fail("Wrong instance in array copy");
         }
     }
     $cursor->fetchAfter();
     $cursor->fetchBefore();
     $index = $cursor->getIndexLeft();
     // Test in-memory order while exporting
     foreach ($cursor->getArrayCopy(true) as $key => $object) {
         if ($key < $index) {
             $this->fail("Wrong order in sorted array copy");
         }
     }
 }