mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
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:
parent
26813b9221
commit
fcca1d454d
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user