From 85ea27dba2d7531531e5adeb51463e1d489ac6c8 Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Sun, 1 Apr 2012 15:55:49 +0200 Subject: [PATCH] Adding tests for additional usages of the proxy classname in ORM public API Like Proxy classnames in DQL, EM#getRepository, EM#getReference --- .../Functional/ProxiesLikeEntitiesTest.php | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/Doctrine/Tests/ORM/Functional/ProxiesLikeEntitiesTest.php b/tests/Doctrine/Tests/ORM/Functional/ProxiesLikeEntitiesTest.php index 66184a8a8..52ac8f591 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ProxiesLikeEntitiesTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ProxiesLikeEntitiesTest.php @@ -96,6 +96,36 @@ class ProxiesLikeEntitiesTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->flush(); } + /** + * Verifying that proxies can be used without problems as query parameters + */ + public function testFindWithProxyName() + { + $result = $this + ->_em + ->find('Doctrine\Tests\Proxies\__CG__\Doctrine\Tests\Models\CMS\CmsUser', $this->user->getId()); + $this->assertSame($this->user->getId(), $result->getId()); + $this->_em->clear(); + $result = $this + ->_em + ->getReference('Doctrine\Tests\Proxies\__CG__\Doctrine\Tests\Models\CMS\CmsUser', $this->user->getId()); + $this->assertSame($this->user->getId(), $result->getId()); + $this->_em->clear(); + $result = $this + ->_em + ->getRepository('Doctrine\Tests\Proxies\__CG__\Doctrine\Tests\Models\CMS\CmsUser') + ->findOneBy(array('username' => $this->user->username)); + $this->assertSame($this->user->getId(), $result->getId()); + $this->_em->clear(); + $result = $this + ->_em + ->createQuery('SELECT u FROM Doctrine\Tests\Proxies\__CG__\Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = ?1') + ->setParameter(1, $this->user->getId()) + ->getSingleResult(); + $this->assertSame($this->user->getId(), $result->getId()); + $this->_em->clear(); + } + protected function tearDown() { $this->_em->createQuery('DELETE FROM Doctrine\Tests\Models\CMS\CmsUser u')->execute();