function DatabaseTransactionTestCase::testTransactionsNotSupported in SimpleTest 7
Test that a database that doesn't support transactions fails correctly.
If the active connection supports transactions, this test does nothing.
File
- tests/
database_test.test, line 2803
Class
- DatabaseTransactionTestCase
- Test transaction support, particularly nesting.
Code
function testTransactionsNotSupported() {
try {
$connection = Database::getConnection();
if (!$connection
->supportsTransactions()) {
// Start a "required" transaction. This should fail if we do this
// on a database that does not actually support transactions, and
// the current database does claim to NOT support transactions.
$txn = db_transaction(TRUE);
$this
->fail('No transaction failure registered.');
}
} catch (TransactionsNotSupportedException $e) {
$this
->pass('Exception thrown for unsupported transactions.');
}
}