From 8d1b852aa22569fc62c0b9a3ea9b13713b08de84 Mon Sep 17 00:00:00 2001 From: Alexander Date: Sat, 15 Oct 2011 17:31:09 +0200 Subject: [PATCH] Added tests for not loading the entity + fixed a test --- .../Doctrine/Tests/ORM/Functional/LifecycleCallbackTest.php | 5 ++++- tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1238Test.php | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/Doctrine/Tests/ORM/Functional/LifecycleCallbackTest.php b/tests/Doctrine/Tests/ORM/Functional/LifecycleCallbackTest.php index a860ecd62..35eb5443c 100644 --- a/tests/Doctrine/Tests/ORM/Functional/LifecycleCallbackTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/LifecycleCallbackTest.php @@ -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'); } -} \ No newline at end of file +} diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1238Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1238Test.php index 93a89818e..467577a43 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1238Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1238Test.php @@ -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"); } }