1
0
mirror of synced 2025-02-20 22:23:14 +03:00

Added tests for not loading the entity + fixed a test

This commit is contained in:
Alexander 2011-10-15 17:31:09 +02:00
parent f47e1feac6
commit 8d1b852aa2
2 changed files with 8 additions and 1 deletions

View File

@ -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');
}
}
}

View File

@ -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");
}
}