Skip to content

Commit

Permalink
Add regression test for #7163
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Aug 8, 2015
1 parent 05b11a4 commit 9b0c1fc
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/TestCase/ORM/QueryRegressionTest.php
Expand Up @@ -1022,4 +1022,26 @@ public function testDotNotationNotOverride()

$this->assertEquals([['name' => 'nate', 'tag' => 'tag1']], $results);
}

/**
* Test expression based ordering with unions.
*
* @return void
*/
public function testComplexOrderWithUnion()
{
$table = TableRegistry::get('Comments');
$query = $table->find();
$inner = $table->find()->where(['id >' => 3]);
$inner2 = $table->find()->where(['id <' => 3]);

$order = $query->func()->concat(['inside__comment' => 'literal', 'test']);

$query->select(['inside__comment' => 'Comments__comment'])
->from(['inside' => $inner->unionAll($inner2)])
->orderAsc($order);

$results = $query->toArray();
$this->assertCount(5, $results);
}
}

0 comments on commit 9b0c1fc

Please sign in to comment.