Skip to content

Commit b6aca59

Browse files
committed
Add test case to cover reserved words in order-by
1 parent a000e54 commit b6aca59

File tree

1 file changed

+2
-0
lines changed
  • lib/internal/Magento/Framework/Data/Test/Unit/Collection

1 file changed

+2
-0
lines changed

lib/internal/Magento/Framework/Data/Test/Unit/Collection/DbTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,14 @@ public function testSetAddOrder()
9292
$this->collection->addOrder('some_field', Collection::SORT_ORDER_ASC);
9393
$this->collection->setOrder('other_field', Collection::SORT_ORDER_ASC);
9494
$this->collection->addOrder('other_field', Collection::SORT_ORDER_DESC);
95+
$this->collection->addOrder('group', Collection::SORT_ORDER_ASC);
9596

9697
$this->collection->load();
9798
$selectOrders = $select->getPart(Select::ORDER);
9899
$this->assertEquals(['select_field', 'ASC'], array_shift($selectOrders));
99100
$this->assertEquals('some_field ASC', (string)array_shift($selectOrders));
100101
$this->assertEquals('other_field DESC', (string)array_shift($selectOrders));
102+
$this->assertEquals('`group` ASC', (string)array_shift($selectOrders)); // Reserved words need to be quoted
101103
$this->assertEmpty(array_shift($selectOrders));
102104
}
103105

0 commit comments

Comments
 (0)