Database::
renameConnection('default', 'original_database_connection'
);
Database::
addConnectionInfo('default', 'default',
$driver_test_connection);
// Close and reopen the database connection, so the database init commands
// get executed.
Database::
closeConnection('default', 'default'
);
$connection = Database::
getConnection('default', 'default'
);
$query = 'SELECT @@SESSION.tx_isolation';
// The database variable "tx_isolation" has been removed in MySQL v8.0 and
// has been replaced by "transaction_isolation".
// @see https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_tx_isolation
if (!
$connection->
isMariaDb() &&
version_compare($connection->
version(), '8.0.0-AnyName', '>'
)) { $query = 'SELECT @@SESSION.transaction_isolation';
} // Test that transaction level is REPEATABLE READ.
$this->
assertEquals('REPEATABLE-READ',
$connection->
query($query)->
fetchField());
// Restore the old database connection.
Database::
addConnectionInfo('default', 'default',
$connection_info['default'
]);
Database::
closeConnection('default', 'default'
);
Database::
getConnection('default', 'default'
);
}}