From 689469a979802635fe77dd0453beda371d88b2cb Mon Sep 17 00:00:00 2001 From: pookey Date: Wed, 20 Jun 2007 13:09:26 +0000 Subject: [PATCH] * Adding an orderby test case to aggregate test --- tests/Query/AggregateValueTestCase.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/Query/AggregateValueTestCase.php b/tests/Query/AggregateValueTestCase.php index 01989c366..5bb064e2f 100644 --- a/tests/Query/AggregateValueTestCase.php +++ b/tests/Query/AggregateValueTestCase.php @@ -108,6 +108,23 @@ class Doctrine_Query_AggregateValue_TestCase extends Doctrine_UnitTestCase $this->assertEqual($users[1]->count, 2); } + public function testAggregateOrder() + { + $q = new Doctrine_Query(); + + $q->select('u.name, COUNT(u.id) count')->from('User u')->groupby('u.name')->orderby('count'); + + $users = $q->execute(); + + $this->assertEqual($users->count(), 2); + + $this->assertEqual($users[0]->state(), Doctrine_Record::STATE_PROXY); + $this->assertEqual($users[1]->state(), Doctrine_Record::STATE_PROXY); + + $this->assertEqual($users[0]->count, 2); + $this->assertEqual($users[1]->count, 2); + } + public function testAggregateValueMappingSupportsLeftJoins() { $q = new Doctrine_Query();