/**
  * @group DDC-3619
  * @group 1338
  */
 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));
 }
Exemple #2
0
 /**
  * @group DDC-2432
  */
 public function testFailedProxyCloningDoesNotMarkTheProxyAsInitialized()
 {
     $persister = $this->getMock('Doctrine\\ORM\\Persisters\\BasicEntityPersister', array('load'), array(), '', false);
     $this->uowMock->setEntityPersister('Doctrine\\Tests\\Models\\ECommerce\\ECommerceFeature', $persister);
     /* @var $proxy \Doctrine\Common\Proxy\Proxy */
     $proxy = $this->proxyFactory->getProxy('Doctrine\\Tests\\Models\\ECommerce\\ECommerceFeature', array('id' => 42));
     $persister->expects($this->atLeastOnce())->method('load')->will($this->returnValue(null));
     try {
         $cloned = clone $proxy;
         $this->fail('An exception was expected to be raised');
     } catch (EntityNotFoundException $exception) {
     }
     $this->assertFalse($proxy->__isInitialized());
     $this->assertInstanceOf('Closure', $proxy->__getInitializer(), 'The initializer wasn\'t removed');
     $this->assertInstanceOf('Closure', $proxy->__getCloner(), 'The cloner wasn\'t removed');
 }