diff --git a/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php b/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php index df7256e44..0c2d7fde4 100644 --- a/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php +++ b/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php @@ -302,6 +302,21 @@ class UnitOfWorkTest extends \Doctrine\Tests\OrmTestCase $this->_unitOfWork->computeChangeSet($metadata, $user); } + 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)); + } + /** * Data Provider *