From b6cbcb855b4cdbf7efccd135559409a43c0e75f5 Mon Sep 17 00:00:00 2001 From: guilhermeblanco Date: Wed, 3 Mar 2010 02:27:11 +0000 Subject: [PATCH] [2.0][DDC-331] Added coverage to CTI not generating valid SQL when fetching for a parent field ona child class. --- .../ORM/Functional/Ticket/DDC331Test.php | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 tests/Doctrine/Tests/ORM/Functional/Ticket/DDC331Test.php diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC331Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC331Test.php new file mode 100644 index 000000000..512b1c9ea --- /dev/null +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC331Test.php @@ -0,0 +1,42 @@ + + */ +class DDC331Test extends \Doctrine\Tests\OrmFunctionalTestCase +{ + protected function setUp() { + $this->useModelSet('company'); + parent::setUp(); + } + + public function testSelectFieldOnRootEntity() + { + $employee = new CompanyEmployee; + $employee->setName('Roman S. Borschel'); + $employee->setSalary(100000); + $employee->setDepartment('IT'); + + $this->_em->persist($employee); + $this->_em->flush(); + $this->_em->clear(); + + $q = $this->_em->createQuery('SELECT e.name FROM Doctrine\Tests\Models\Company\CompanyEmployee e'); + $this->assertEquals('SELECT c0_.name AS name0 FROM company_employees c1_ INNER JOIN company_persons c0_ ON c1_.id = c0_.id LEFT JOIN company_managers c2_ ON c1_.id = c2_.id', $q->getSql()); + } +} \ No newline at end of file