Cassandra\PagingIntegrationTest::testNoPagingMemoryLeak PHP Method

testNoPagingMemoryLeak() public method

This test will ensure that the driver does not create memory leaks associated advancing to the next page of results.
    public function testNoPagingMemoryLeak()
    {
        // Create the user types and table for the test
        $this->session->execute(new SimpleStatement("DROP TABLE {$this->tableNamePrefix}"));
        $this->session->execute(new SimpleStatement("CREATE TYPE price_history (time timestamp, price float)"));
        $priceHistory = Type::userType("time", Type::timestamp(), "price", Type::float());
        $this->session->execute(new SimpleStatement("CREATE TYPE purchase_stats (day_of_week int, total_purchases int)"));
        $purchaseStats = Type::userType("day_of_week", Type::int(), "total_purchases", Type::int());
        $this->session->execute(new SimpleStatement("CREATE TABLE {$this->tableNamePrefix} (id uuid PRIMARY KEY,\n                history frozen<price_history>, stats frozen<purchase_stats>,\n                comments text)"));
        // Populate the table with some random data
        $totalInserts = 500;
        $statement = $this->session->prepare("INSERT INTO {$this->tableNamePrefix}\n            (id, history, stats, comments) VALUES (?, ?, ?, ?)");
        foreach (range(1, $totalInserts) as $i) {
            // Create the values for the insert
            $history = $priceHistory->create("time", new Timestamp(mt_rand(1270094400000, 1459483200000)), "price", new Float(mt_rand(1, 1000) / 100));
            $stats = $purchaseStats->create("day_of_week", mt_rand(0, 6), "total_purchases", mt_rand(0, 1000));
            $values = array(new Uuid(), $history, $stats, $this->randomString());
            $options = new ExecutionOptions(array("arguments" => $values));
            $this->session->execute($statement, $options);
        }
        // Select all the rows in the table using paging
        $statement = new SimpleStatement("SELECT * FROM {$this->tableNamePrefix}");
        $options = new ExecutionOptions(array("page_size" => 2));
        $rows = $this->session->execute($statement, $options);
        // Validate paging and ensure all the rows were read
        $count = $this->validatePageResults($rows);
        $this->assertEquals($totalInserts, $count);
    }