Cassandra\SimpleStatementIntegrationTest::testCaseSensitiveByName PHP Method

testCaseSensitiveByName() public method

This test will ensure that the PHP driver supports case sensitive named parameters using simple statement queries.
    public function testCaseSensitiveByName()
    {
        // Determine if the test should be skipped
        if (version_compare(\Cassandra::CPP_DRIVER_VERSION, "2.2.3") < 0) {
            $this->markTestSkipped("Skipping {$this->getName()}: Case sensitivity issue fixed in DataStax C/C++ v 2.2.3");
        }
        // Create the table
        $query = "CREATE TABLE {$this->tableNamePrefix} (key timeuuid, value_int int, \"value_iNT\" int, value_boolean boolean, \"value_BooLeaN\" boolean, PRIMARY KEY (value_int, key)) WITH CLUSTERING ORDER BY (key DESC)";
        $this->session->execute(new SimpleStatement($query));
        // Create the insert query and insert valid named parameters
        $query = "INSERT INTO {$this->tableNamePrefix} (key, value_int, \"value_iNT\", value_boolean, \"value_BooLeaN\") VALUES (?, ?, ?, ?, ?)";
        $values = array(array("\"value_BooLeaN\"" => false, "\"value_boolean\"" => true, "\"value_iNT\"" => 11, "\"value_int\"" => 1, "key" => new Timeuuid()), array("\"value_int\"" => 2, "\"value_BooLeaN\"" => true, "key" => new Timeuuid(), "\"value_boolean\"" => false, "\"value_iNT\"" => 22), array("key" => new Timeuuid(), "\"value_int\"" => 3, "\"value_iNT\"" => 33, "\"value_boolean\"" => false, "\"value_BooLeaN\"" => true));
        $statement = new SimpleStatement($query);
        foreach ($values as $value) {
            $options = new ExecutionOptions(array("arguments" => $value));
            $this->session->execute($statement, $options);
        }
        // Select and assert the values
        $query = "SELECT * FROM {$this->tableNamePrefix}";
        $statement = new SimpleStatement($query);
        $rows = $this->session->execute($statement);
        $this->assertCount(count($values), $rows);
        foreach ($rows as $i => $row) {
            $expected = array();
            foreach ($values[$i] as $key => $value) {
                $expected[trim($key, "\"")] = $value;
            }
            $this->assertEquals($expected, $row);
        }
    }