From 6e8057b6ea664ec04c6f64219557237e82227ca2 Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Fri, 5 Dec 2014 17:10:39 +0100 Subject: [PATCH] DDC-3434 - adding test case for `HIDDEN` modifier fields in `ORDER BY` sequences: should be preserved in any case --- .../LimitSubqueryOutputWalkerTest.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/Doctrine/Tests/ORM/Tools/Pagination/LimitSubqueryOutputWalkerTest.php b/tests/Doctrine/Tests/ORM/Tools/Pagination/LimitSubqueryOutputWalkerTest.php index 78d8f7626..a012d45df 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Pagination/LimitSubqueryOutputWalkerTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Pagination/LimitSubqueryOutputWalkerTest.php @@ -211,5 +211,22 @@ class LimitSubqueryOutputWalkerTest extends PaginationTestCase $query->getSQL() ); } + + /** + * @group DDC-3434 + */ + public function testLimitSubqueryWithHiddenSelectionInOrderBy() + { + $query = $this->entityManager->createQuery( + 'SELECT a, a.name AS HIDDEN ord FROM Doctrine\Tests\ORM\Tools\Pagination\Author a ORDER BY ord DESC' + ); + + $query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'Doctrine\ORM\Tools\Pagination\LimitSubqueryOutputWalker'); + + $this->assertEquals( + 'SELECT DISTINCT id_0, name_2 FROM (SELECT a0_.id AS id_0, a0_.name AS name_1, a0_.name AS name_2 FROM Author a0_ ORDER BY name_2 DESC) dctrn_result ORDER BY name_2 DESC', + $query->getSql() + ); + } }