From 2e5dd84fc2ea61ee4a452d1edff33a08eac9da6c Mon Sep 17 00:00:00 2001 From: zYne Date: Thu, 15 Nov 2007 13:45:41 +0000 Subject: [PATCH] tests for CTI column referencing in DQL --- tests/ClassTableInheritanceTestCase.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/ClassTableInheritanceTestCase.php b/tests/ClassTableInheritanceTestCase.php index 47f34d2a8..53628b5a6 100644 --- a/tests/ClassTableInheritanceTestCase.php +++ b/tests/ClassTableInheritanceTestCase.php @@ -119,7 +119,20 @@ class Doctrine_ClassTableInheritance_TestCase extends Doctrine_UnitTestCase $this->assertTrue(isset($record->added)); $this->assertEqual($record->age, 13); } - + + public function testReferenfingParentColumnsUsesProperAliases() + { + $q = new Doctrine_Query(); + $q->from('CTITest c')->where("c.name = 'Jack'"); + + $this->assertEqual($q->getSql(), "SELECT c.id AS c__id, c2.name AS c__name, c2.verified AS c__verified, c3.added AS c__added, c.age AS c__age FROM c_t_i_test_parent4 c LEFT JOIN c_t_i_test_parent2 c2 ON c.id = c2.id LEFT JOIN c_t_i_test_parent3 c3 ON c.id = c3.id WHERE c2.name = 'Jack'"); + + $q = new Doctrine_Query(); + $q->from('CTITest c')->where("name = 'Jack'"); + + $this->assertEqual($q->getSql(), "SELECT c.id AS c__id, c2.name AS c__name, c2.verified AS c__verified, c3.added AS c__added, c.age AS c__age FROM c_t_i_test_parent4 c LEFT JOIN c_t_i_test_parent2 c2 ON c.id = c2.id LEFT JOIN c_t_i_test_parent3 c3 ON c.id = c3.id WHERE c2.name = 'Jack'"); + } + public function testFetchingCtiRecordsSupportsLimitSubqueryAlgorithm() { $record = new CTITestOneToManyRelated;