Fixed incorrect transaction management in locking tests.
This commit is contained in:
parent
35e49aaf9f
commit
4a9369de9e
@ -125,7 +125,13 @@ class LockTest extends \Doctrine\Tests\OrmFunctionalTestCase {
|
|||||||
$this->_em->flush();
|
$this->_em->flush();
|
||||||
|
|
||||||
$this->_em->beginTransaction();
|
$this->_em->beginTransaction();
|
||||||
$this->_em->lock($article, LockMode::PESSIMISTIC_WRITE);
|
try {
|
||||||
|
$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();
|
||||||
$this->_em->lock($article, LockMode::PESSIMISTIC_READ);
|
try {
|
||||||
|
$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']);
|
||||||
|
@ -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(
|
||||||
|
@ -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()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user