Skip to content

Commit 844962b

Browse files
committed
[tests] added test on ORDER BY <aggregate function>
Signed-off-by: Dorian Savina <[email protected]>
1 parent 2b6252b commit 844962b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tests/Mouf/Database/MagicQueryTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ public function testStandardSelect()
152152

153153
$sql = 'SELECT * FROM users WHERE id IN (1, 3)';
154154
$this->assertEquals("SELECT * FROM users WHERE id IN (1, 3)", self::simplifySql($magicQuery->build($sql)));
155+
156+
$sql = 'SELECT country.* FROM country JOIN users ON country.id = users.country_id GROUP BY country.id ORDER BY COUNT(users.id) DESC';
157+
$this->assertEquals('SELECT country.* FROM country JOIN users ON (country.id = users.country_id) GROUP BY country.id ORDER BY COUNT(users.id) DESC', self::simplifySql($magicQuery->build($sql)));
155158
}
156159

157160
/**

0 commit comments

Comments
 (0)