|
|
@@ -1788,6 +1788,29 @@ class QueryTest extends TestCase
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * Test that order() works with an associative array which contains extra values.
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function testSelectOrderByAssociativeArrayContainingExtraExpressions()
|
|
|
+ {
|
|
|
+ $this->deprecated(function () {
|
|
|
+ $this->loadFixtures('Articles');
|
|
|
+ $query = new Query($this->connection);
|
|
|
+ $query->select(['id'])
|
|
|
+ ->from('articles')
|
|
|
+ ->order([
|
|
|
+ 'id' => 'desc -- Comment',
|
|
|
+ ]);
|
|
|
+ $result = $query->execute();
|
|
|
+ $this->assertEquals(['id' => 3], $result->fetch('assoc'));
|
|
|
+ $this->assertEquals(['id' => 2], $result->fetch('assoc'));
|
|
|
+ $this->assertEquals(['id' => 1], $result->fetch('assoc'));
|
|
|
+ $result->closeCursor();
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* Test orderAsc() and its input types.
|
|
|
*
|
|
|
* @return void
|