1
0
mirror of synced 2025-01-31 20:41:44 +03:00

Correctly dealing with emulated cascades in ExtraLazyCollectionTest

This commit is contained in:
Marco Pivetta 2015-01-14 14:36:01 +01:00
parent 00a8265fb9
commit c571f6f6a9

View File

@ -523,8 +523,16 @@ class ExtraLazyCollectionTest extends \Doctrine\Tests\OrmFunctionalTestCase
$otherClass->childClasses->removeElement($childClass);
$this->assertFalse($otherClass->childClasses->isInitialized(), 'Collection is not initialized.');
$expectedQueryCount = $queryCount + 1;
if (! $this->_em->getConnection()->getDatabasePlatform()->supportsForeignKeyConstraints()) {
// the ORM emulates cascades in a JTI if the underlying platform does not support them
$expectedQueryCount = $queryCount + 2;
};
$this->assertEquals(
$queryCount + 2,
$expectedQueryCount,
$this->getCurrentQueryCount(),
'One removal per table in the JTI has been executed'
);
@ -585,8 +593,15 @@ class ExtraLazyCollectionTest extends \Doctrine\Tests\OrmFunctionalTestCase
$otherClass->childClasses->removeElement($childClass);
$expectedQueryCount = $queryCount + 1;
if (! $this->_em->getConnection()->getDatabasePlatform()->supportsForeignKeyConstraints()) {
// the ORM emulates cascades in a JTI if the underlying platform does not support them
$expectedQueryCount = $queryCount + 2;
};
$this->assertEquals(
$queryCount + 2,
$expectedQueryCount,
$this->getCurrentQueryCount(),
'Removing a persisted entity should cause two queries to be executed.'
);