Skip to content
Permalink
Browse files

Enforce specific ordering to fix failing tests.

With the addition of foreign key constraints some ordering changes
occur, this solidifies the ordering of results.
  • Loading branch information...
markstory committed Sep 6, 2014
1 parent c29bed8 commit 94f18be055d7c2a87167829ffe5b6951e65799ca
Showing with 8 additions and 4 deletions.
  1. +8 −4 tests/TestCase/ORM/QueryTest.php
@@ -1719,7 +1719,9 @@ public function testFormatDeepAssocationRecords() {
});
};
$query = $table->find()
->contain(['Articles' => $builder, 'Articles.Authors' => $builder]);
->contain(['Articles' => $builder, 'Articles.Authors' => $builder])
->order(['Articles.id' => 'ASC']);
$query->formatResults(function($results) {
return $results->map(function($row) {
return sprintf(
@@ -1799,9 +1801,11 @@ public function testContainInAssociationQuery() {
$table->belongsTo('Articles');
$table->association('Articles')->target()->belongsTo('Authors');
$query = $table->find()->contain(['Articles' => function($q) {
return $q->contain('Authors');
}]);
$query = $table->find()
->order(['Articles.id' => 'ASC'])
->contain(['Articles' => function($q) {
return $q->contain('Authors');
}]);
$results = $query->extract('article.author.name')->toArray();
$expected = ['mariano', 'mariano', 'larry', 'larry'];
$this->assertEquals($expected, $results);

0 comments on commit 94f18be

Please sign in to comment.
You can’t perform that action at this time.