Cassandra\RetryPolicyIntegrationTest::testDowngradingPolicy PHP Метод

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

This test will ensure that the PHP driver supports the downgrading retry policy when executing statements.
    public function testDowngradingPolicy()
    {
        // Create the retry policy (RF = 3 with 1 node)
        $policy = new RetryPolicy\DowngradingConsistency();
        // Iterate over each statement type
        foreach (range(1, 3) as $statementType) {
            // Determine if the statement type should be skipped
            if ($statementType == self::BATCH_STATEMENT && version_compare(\Cassandra::CPP_DRIVER_VERSION, "2.2.3") < 0) {
                if (Integration::isDebug()) {
                    fprintf(STDOUT, "Skipping Batch Statements in %s: Issue fixed in DataStax C/C++ v2.2.3" . PHP_EOL, $this->getName());
                }
            } else {
                // Insert and assert values with CONSISTENCY_ALL
                $this->insert($statementType, $policy, 0, self::NUMBER_OF_INSERTS, \Cassandra::CONSISTENCY_ALL);
                $this->assert($policy, 0, self::NUMBER_OF_INSERTS, \Cassandra::CONSISTENCY_ALL);
                // Insert and assert values with CONSISTENCY_QUORUM
                $this->insert($statementType, $policy, 1, self::NUMBER_OF_INSERTS, \Cassandra::CONSISTENCY_QUORUM);
                $this->assert($policy, 1, self::NUMBER_OF_INSERTS, \Cassandra::CONSISTENCY_QUORUM);
                // Insert and assert values with CONSISTENCY_TWO
                $this->insert($statementType, $policy, 2, self::NUMBER_OF_INSERTS, \Cassandra::CONSISTENCY_TWO);
                $this->assert($policy, 2, self::NUMBER_OF_INSERTS, \Cassandra::CONSISTENCY_TWO);
            }
        }
    }