From 1e38d7d07edd0ccf6a510328270662566df9c093 Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Tue, 17 Mar 2015 22:30:06 +0000 Subject: [PATCH] #1338 DDC-3619 - moved test to unit of work tests --- tests/Doctrine/Tests/ORM/UnitOfWorkTest.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php b/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php index 97f60f859..7cae3c73d 100644 --- a/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php +++ b/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php @@ -229,6 +229,21 @@ class UnitOfWorkTest extends \Doctrine\Tests\OrmTestCase $this->setExpectedException('InvalidArgumentException'); $this->_unitOfWork->lock(null, null, null); } + + public function testRemovedAndRePersistedEntitiesAreInTheIdentityMapAndAreNotGarbageCollected() + { + $entity = new ForumUser(); + $entity->id = 123; + + $this->_unitOfWork->registerManaged($entity, array('id' => 123), array()); + $this->assertTrue($this->_unitOfWork->isInIdentityMap($entity)); + + $this->_unitOfWork->remove($entity); + $this->assertFalse($this->_unitOfWork->isInIdentityMap($entity)); + + $this->_unitOfWork->persist($entity); + $this->assertTrue($this->_unitOfWork->isInIdentityMap($entity)); + } } /**