Adding tests for additional usages of the proxy classname in ORM public API
Like Proxy classnames in DQL, EM#getRepository, EM#getReference
This commit is contained in:
parent
d1e868a32a
commit
85ea27dba2
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user