public function testNextPageCaching() { $results = array(); $pageSize = 2; $options = array("page_size" => $pageSize); $statement = new SimpleStatement("SELECT * FROM {$this->tableNamePrefix}"); // Get first page $rows = $this->session->execute($statement, new ExecutionOptions($options)); $this->assertEquals($rows->count(), $pageSize); $values = self::convertRowsToArray($rows, "value"); // Get next page (verify that it's a different page) $nextRows = $rows->nextPage(); $nextValues = self::convertRowsToArray($nextRows, "value"); $this->assertEquals($nextRows->count(), $pageSize); $this->assertNotEquals($values, $nextValues); // Get next page again (verify that it's the same) $nextRowsAgain = $rows->nextPage(); $this->assertEquals($nextRowsAgain->count(), $pageSize); $nextValuesAgain = self::convertRowsToArray($nextRowsAgain, "value"); $this->assertEquals($nextValues, $nextValuesAgain); // Get next page asynchonously (verify that it's the same) $nextRowsAsync = $rows->nextPageAsync()->get(); $this->assertEquals($nextRowsAsync->count(), $pageSize); $nextValuesAsync = self::convertRowsToArray($nextRowsAsync, "value"); $this->assertEquals($nextValues, $nextValuesAsync); // Get the next page's page (verify that it's a different page) $lastRows = $nextRows->nextPage(); $this->assertEquals($lastRows->count(), $pageSize); $lastValues = self::convertRowsToArray($lastRows, "value"); $this->assertNotEquals($nextValues, $lastValues); }