public function testDefaultConsistencyLevel()
{
// Create a new table
$query = "CREATE TABLE {$this->tableNamePrefix} (key int PRIMARY KEY)";
$statement = new SimpleStatement($query);
$this->session->execute($statement);
// Enable tracing
$this->ccm->enableTracing(true);
// Insert a value into the table
$insertQuery = "INSERT INTO {$this->tableNamePrefix} (key) VALUES (1)";
$statement = new SimpleStatement($insertQuery);
$this->session->execute($statement);
// Check the trace logs to determine the consistency level used
$query = "SELECT parameters FROM system_traces.sessions";
$statement = new SimpleStatement($query);
$rows = $this->session->execute($statement);
$isAsserted = false;
foreach ($rows as $row) {
// Find the parameters that contains the insert query
$parameters = $row["parameters"];
$query = $parameters["query"];
if ($query == $insertQuery) {
$consistency = $parameters["consistency_level"];
$this->assertEquals(self::DEFAULT_CONSISTENCY_LEVEL, $consistency);
$isAsserted = true;
break;
}
}
// Ensure that an assertion was made (e.g. consistency level used)
$this->assertTrue($isAsserted);
}