Skip to content

Commit cf11f1e

Browse files
authored
Add ORDER BY clause to SELECT query (#12222)
The order of results is not guaranteed unless we do so, and the test can fail in some cases: There was 1 failure: 1) Doctrine\Tests\ORM\Functional\QueryTest::testToIterableWithMixedResultArbitraryJoinsScalars Failed asserting that two strings are equal. --- Expected +++ Actual @@ @@ -'Doctrine 2' +'lala 2' /home/runner/work/orm/orm/tests/Tests/ORM/Functional/QueryTest.php:481
1 parent eae6577 commit cf11f1e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tests/Tests/ORM/Functional/QueryTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,9 @@ public function testToIterableWithMixedResultEntityScalars(): void
432432
$this->_em->flush();
433433
$this->_em->clear();
434434

435-
$query = $this->_em->createQuery('select a, a.topic, a.text from ' . CmsArticle::class . ' a');
435+
$query = $this->_em->createQuery(
436+
'select a, a.topic, a.text from ' . CmsArticle::class . ' a order by a.id asc',
437+
);
436438
$result = $query->toIterable();
437439

438440
$it = iterator_to_array($result);

0 commit comments

Comments
 (0)