From 25d40caf1e6c23c7c46f6f693def859155672c0e Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Mon, 12 Jan 2015 21:43:37 +0100 Subject: [PATCH] #1245 DDC-2504 - extracting test: Removing a managed item from a one-to-many extra-lazy association to a JTI does not initialize the collection --- .../Functional/ExtraLazyCollectionTest.php | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/tests/Doctrine/Tests/ORM/Functional/ExtraLazyCollectionTest.php b/tests/Doctrine/Tests/ORM/Functional/ExtraLazyCollectionTest.php index 94dbfbf97..308b3aad2 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ExtraLazyCollectionTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ExtraLazyCollectionTest.php @@ -511,7 +511,29 @@ class ExtraLazyCollectionTest extends \Doctrine\Tests\OrmFunctionalTestCase } /** - * + * @group DDC-2504 + */ + public function testRemovalOfManagedElementFromOneToManyJoinedInheritanceCollectionDoesNotInitializeIt() + { + $otherClass = $this->_em->find(DDC2504OtherClass::CLASSNAME, $this->ddc2504OtherClassId); + $childClass = $this->_em->find(DDC2504ChildClass::CLASSNAME, $this->ddc2504ChildClassId); + + $queryCount = $this->getCurrentQueryCount(); + + $otherClass->childClasses->removeElement($childClass); + + $this->assertFalse($otherClass->childClasses->isInitialized(), 'Collection is not initialized.'); + $this->assertEquals( + $queryCount + 2, + $this->getCurrentQueryCount(), + 'One removal per table in the JTI has been executed' + ); + + $this->assertFalse($otherClass->childClasses->contains($childClass)); + } + + /** + * @group DDC-2504 */ public function testRemoveElementOneToManyJoinedInheritance() {