1
0
mirror of synced 2025-01-31 12:32:59 +03:00

Fixed incorrect transaction management in locking tests.

This commit is contained in:
Roman S. Borschel 2010-06-07 00:14:43 +02:00
parent 35e49aaf9f
commit 4a9369de9e
3 changed files with 15 additions and 7 deletions

View File

@ -125,7 +125,13 @@ class LockTest extends \Doctrine\Tests\OrmFunctionalTestCase {
$this->_em->flush(); $this->_em->flush();
$this->_em->beginTransaction(); $this->_em->beginTransaction();
try {
$this->_em->lock($article, LockMode::PESSIMISTIC_WRITE); $this->_em->lock($article, LockMode::PESSIMISTIC_WRITE);
$this->_em->commit();
} catch (\Exception $e) {
$this->_em->rollback();
throw $e;
}
$query = array_pop( $this->_sqlLoggerStack->queries ); $query = array_pop( $this->_sqlLoggerStack->queries );
$this->assertContains($writeLockSql, $query['sql']); $this->assertContains($writeLockSql, $query['sql']);
@ -149,7 +155,13 @@ class LockTest extends \Doctrine\Tests\OrmFunctionalTestCase {
$this->_em->flush(); $this->_em->flush();
$this->_em->beginTransaction(); $this->_em->beginTransaction();
try {
$this->_em->lock($article, LockMode::PESSIMISTIC_READ); $this->_em->lock($article, LockMode::PESSIMISTIC_READ);
$this->_em->commit();
} catch (\Exception $e) {
$this->_em->rollback();
throw $e;
}
$query = array_pop( $this->_sqlLoggerStack->queries ); $query = array_pop( $this->_sqlLoggerStack->queries );
$this->assertContains($readLockSql, $query['sql']); $this->assertContains($readLockSql, $query['sql']);

View File

@ -8,7 +8,6 @@ class DDC144Test extends \Doctrine\Tests\OrmFunctionalTestCase
{ {
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger); //$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
$this->_schemaTool->createSchema(array( $this->_schemaTool->createSchema(array(

View File

@ -10,15 +10,12 @@ class DDC353Test extends \Doctrine\Tests\OrmFunctionalTestCase
protected function setUp() protected function setUp()
{ {
parent::setUp(); parent::setUp();
try { try {
$this->_schemaTool->createSchema(array( $this->_schemaTool->createSchema(array(
$this->_em->getClassMetadata(__NAMESPACE__ . '\DDC353File'), $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC353File'),
$this->_em->getClassMetadata(__NAMESPACE__ . '\DDC353Picture'), $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC353Picture'),
)); ));
} catch(\Exception $e) { } catch(\Exception $ignored) {}
}
} }
public function testWorkingCase() public function testWorkingCase()