From 813886a08604cf49a89c794e610b642ec040c97f Mon Sep 17 00:00:00 2001 From: "Jonathan.Wage" Date: Tue, 12 Jun 2007 22:09:46 +0000 Subject: [PATCH] Added test for failing getLimitSubquery --- tests/Query/SubqueryTestCase.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/Query/SubqueryTestCase.php b/tests/Query/SubqueryTestCase.php index 03b15ee89..cdd10ef9c 100644 --- a/tests/Query/SubqueryTestCase.php +++ b/tests/Query/SubqueryTestCase.php @@ -84,5 +84,26 @@ class Doctrine_Query_Subquery_TestCase extends Doctrine_UnitTestCase $this->assertNotEqual($q->getQuery(), "SELECT e.id AS e__id, e.name AS e__name, (SELECT COUNT(e.id) AS e__0 FROM entity e WHERE e.id = e.id AND (e.type = 0)) AS e__0 FROM entity e WHERE e.name = 'zYne' AND (e.type = 0) LIMIT 1"); } + + public function testGetLimitSubqueryOrderBy() + { + $query = new Doctrine_Query(); + $query->select('u.*, COUNT(DISTINCT a.id) num_albums'); + $query->from('User u, u.Album a'); + $query->orderby('num_albums'); + + try{ + // this causes getLimitSubquery() to be used, and it fails + $query->limit(5); + + $users = $query->execute(); + + $count = $users->count(); + } catch(Doctrine_Exception $e) { + $this->fail(); + } + + $this->assertEqual($count, 1); + } } ?>