Commit 7a87a13f by Carsten Brandt

unit test for postgres transaction

parent cc8a8360
<?php <?php
namespace yiiunit\framework\db\pgsql; namespace yiiunit\framework\db\pgsql;
use yii\db\Transaction;
use yiiunit\framework\db\ConnectionTest; use yiiunit\framework\db\ConnectionTest;
/** /**
...@@ -48,4 +49,29 @@ class PostgreSQLConnectionTest extends ConnectionTest ...@@ -48,4 +49,29 @@ class PostgreSQLConnectionTest extends ConnectionTest
$this->assertEquals('{{column}}', $connection->quoteColumnName('{{column}}')); $this->assertEquals('{{column}}', $connection->quoteColumnName('{{column}}'));
$this->assertEquals('(column)', $connection->quoteColumnName('(column)')); $this->assertEquals('(column)', $connection->quoteColumnName('(column)'));
} }
public function testTransactionIsolation()
{
$connection = $this->getConnection(true);
$transaction = $connection->beginTransaction();
$transaction->setIsolationLevel(Transaction::READ_UNCOMMITTED);
$transaction->commit();
$transaction = $connection->beginTransaction();
$transaction->setIsolationLevel(Transaction::READ_COMMITTED);
$transaction->commit();
$transaction = $connection->beginTransaction();
$transaction->setIsolationLevel(Transaction::REPEATABLE_READ);
$transaction->commit();
$transaction = $connection->beginTransaction();
$transaction->setIsolationLevel(Transaction::SERIALIZABLE);
$transaction->commit();
$transaction = $connection->beginTransaction();
$transaction->setIsolationLevel(Transaction::SERIALIZABLE . ' READ ONLY DEFERABLE');
$transaction->commit();
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment