From db936035e01154da015b2713a7b6a511ab0ff75b Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Sun, 8 Aug 2010 19:46:45 +0200 Subject: [PATCH] Added more tests for DQL joining the primary key entity and querying other fields --- .../Tests/ORM/Functional/Ticket/DDC117Test.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php index 7906314c9..8bd456b35 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php @@ -62,7 +62,22 @@ class DDC117Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->clear(); $dql = "SELECT r, s FROM ".__NAMESPACE__."\DDC117Reference r JOIN r.source s WHERE r.source = ?1"; - $ref = $this->_em->createQuery($dql)->setParameter(1, 1)->getSingleResult(); + $dqlRef = $this->_em->createQuery($dql)->setParameter(1, 1)->getSingleResult(); + + $this->assertType(__NAMESPACE__."\DDC117Reference", $mapRef); + $this->assertType(__NAMESPACE__."\DDC117Article", $mapRef->target()); + $this->assertType(__NAMESPACE__."\DDC117Article", $mapRef->source()); + $this->assertSame($dqlRef, $this->_em->find(__NAMESPACE__."\DDC117Reference", $idCriteria)); + + $this->_em->clear(); + + $dql = "SELECT r, s FROM ".__NAMESPACE__."\DDC117Reference r JOIN r.source s WHERE s.title = ?1"; + $dqlRef = $this->_em->createQuery($dql)->setParameter(1, 'Foo')->getSingleResult(); + + $this->assertType(__NAMESPACE__."\DDC117Reference", $mapRef); + $this->assertType(__NAMESPACE__."\DDC117Article", $mapRef->target()); + $this->assertType(__NAMESPACE__."\DDC117Article", $mapRef->source()); + $this->assertSame($dqlRef, $this->_em->find(__NAMESPACE__."\DDC117Reference", $idCriteria)); } /**