MINOR Moved TransactionTest->testReadonlyTransaction() to PostgreSQLDatabase driver, which is the only one that actually supports it. We can't have tests failing for all other databases by default for this optional feature which can't be detected through the Database API.

This commit is contained in:
Ingo Schommer 2011-04-06 23:18:31 +12:00
parent 26813b9221
commit fcca1d454d

View File

@ -54,43 +54,6 @@ class TransactionTest extends SapphireTest {
}
}
function testReadOnlyTransaction(){
if(DB::getConn()->supportsTransactions()==true){
$obj=new TransactionTest_Object();
$obj->Title='Read only success';
$obj->write();
DB::getConn()->transactionStart('READ ONLY');
try {
$obj=new TransactionTest_Object();
$obj->Title='Read only page failed';
$obj->write();
} catch (Exception $e) {
//could not write this record
//We need to do a rollback or a commit otherwise we'll get error messages
DB::getConn()->transactionRollback();
}
DB::getConn()->transactionEnd();
DataObject::flush_and_destroy_cache();
$success=DataObject::get('TransactionTest_Object', "\"Title\"='Read only success'");
$fail=DataObject::get('TransactionTest_Object', "\"Title\"='Read only page failed'");
//This page should be in the system
$this->assertTrue(is_object($success) && $success->exists());
//This page should NOT exist, we had 'read only' permissions
$this->assertFalse(is_object($fail) && $fail->exists());
}
}
}
class TransactionTest_Object extends DataObject implements TestOnly {