Added tests for not loading the entity + fixed a test
This commit is contained in:
parent
f47e1feac6
commit
8d1b852aa2
@ -78,6 +78,9 @@ class LifecycleCallbackTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
$reference = $this->_em->getReference('Doctrine\Tests\ORM\Functional\LifecycleCallbackTestEntity', $id);
|
||||
$this->assertFalse($reference->postLoadCallbackInvoked);
|
||||
|
||||
$reference->getId(); // doesn't trigger proxy load
|
||||
$this->assertFalse($reference->postLoadCallbackInvoked);
|
||||
|
||||
$reference->getValue(); // trigger proxy load
|
||||
$this->assertTrue($reference->postLoadCallbackInvoked);
|
||||
}
|
||||
@ -278,4 +281,4 @@ class LifecycleListenerPreUpdate
|
||||
{
|
||||
$eventArgs->setNewValue('name', 'Bob');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -52,6 +52,8 @@ class DDC1238Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
// force proxy load, getId() doesn't work anymore
|
||||
$user->getName();
|
||||
$userId = $user->getId();
|
||||
$this->_em->clear();
|
||||
|
||||
@ -60,6 +62,8 @@ class DDC1238Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
|
||||
$user2 = $this->_em->getReference(__NAMESPACE__ . '\\DDC1238User', $userId);
|
||||
|
||||
// force proxy load, getId() doesn't work anymore
|
||||
$user->getName();
|
||||
$this->assertNull($user->getId(), "Now this is null, we already have a user instance of that type");
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user