1
0
mirror of synced 2025-01-17 22:11:41 +03:00

Added test for failing getLimitSubquery

This commit is contained in:
Jonathan.Wage 2007-06-12 22:09:46 +00:00
parent 7b2f77a622
commit 813886a086

View File

@ -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);
}
}
?>