Index: tests/Ticket/DC701DisableLimitSubqueryTestCase.php =================================================================== --- tests/Ticket/DC701DisableLimitSubqueryTestCase.php (revision 0) +++ tests/Ticket/DC701DisableLimitSubqueryTestCase.php (revision 0) @@ -0,0 +1,49 @@ +. + */ + +/** + * Doctrine_Query_MysqlSubquery_TestCase + * + * @package Doctrine + * @author Will Ferrer + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @category Object Relational Mapping + * @link www.doctrine-project.org + * @since 1.0 + * @version $Revision$ + */ +class Doctrine_Ticket_DC701DisableLimitSubquery_TestCase extends Doctrine_UnitTestCase +{ + public function testDisableLimitSubquery() + { + $q = new Doctrine_Query(); + $q->select('u.name, COUNT(DISTINCT a.id) num_albums'); + $q->from('User u, u.Album a'); + $q->orderby('num_albums DESC'); + $q->having('num_albums > 0'); + $q->groupby('u.id'); + $q->limit(5); + $q->setDisableLimitSubquery(true); + + $this->assertEqual($q->getSqlQuery(), 'SELECT e.id AS e__id, e.name AS e__name, COUNT(DISTINCT a.id) AS a__0 FROM entity e LEFT JOIN album a ON e.id = a.user_id WHERE (e.type = 0) GROUP BY e.id HAVING a__0 > 0 ORDER BY a__0 DESC LIMIT 5'); + } + +}