Cassandra\SchemaMetadataIntegrationTest::testIteratorMaterializedViews PHP Метод

testIteratorMaterializedViews() публичный Метод

This test ensures that materialized views are properly handled by the driver.
    public function testIteratorMaterializedViews()
    {
        // Create the tables
        $this->createTablesForMaterializedViews();
        // Create the materialized views
        $this->createSimpleMaterializedView();
        $this->createPrimaryKeyMaterializedView();
        $this->createClusteringKeyMaterializedView();
        // Validate the materialized views
        $keyspace = $this->session->schema()->keyspace($this->keyspaceName);
        $this->assertCount(3, $keyspace->materializedViews());
        $table = $keyspace->table("{$this->tableNamePrefix}_1");
        $materializedViews = $table->materializedViews();
        foreach ($materializedViews as $materializedView) {
            if ($materializedView->name() == "simple") {
                $this->assertMaterializedView($materializedView, "simple", "{$this->tableNamePrefix}_1", array("value1", "key1"), array("value1"), array("key1"));
            } else {
                $this->fail("Invalid Materialized View Name: {$materializedView->name()}");
            }
        }
        $this->assertCount(1, $materializedViews);
        $table = $keyspace->table("{$this->tableNamePrefix}_2");
        $materializedViews = $table->materializedViews();
        $this->assertCount(2, $materializedViews);
        foreach ($materializedViews as $materializedView) {
            if ($materializedView->name() == "primary_key") {
                $this->assertMaterializedView($materializedView, "primary_key", "{$this->tableNamePrefix}_2", array("value1", "key2", "key1"), array("value1", "key2"), array("key1"));
            } else {
                if ($materializedView->name() == "clustering_key") {
                    $this->assertMaterializedView($materializedView, "clustering_key", "{$this->tableNamePrefix}_2", array("value1", "key2", "key1"), array("value1"), array("key2", "key1"));
                } else {
                    $this->fail("Invalid Materialized View Name: {$materializedView->name()}");
                }
            }
        }
    }