Skip to content

Commit

Permalink
Makinga more sane query in the test case
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Jun 4, 2015
1 parent 0f7a99b commit 06eb7d3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/TestCase/ORM/QueryTest.php
Expand Up @@ -2754,19 +2754,23 @@ public function testLeftJoinWithSelect()
->find()
->leftJoinWith('articles.tags', function ($q) {
return $q
->select(['articles.id', 'articles.title'])
->select(['articles.id', 'articles.title', 'tags.name'])
->where(['tags.name' => 'tag3']);
})
->autoFields(true)
->where(['ArticlesTags.tag_id IS NOT' => null])
->group(['authors.id'])
->all();

$expected = ['id' => 3, 'title' => 'Third Article'];
$expected = ['id' => 2, 'title' => 'Second Article'];
$this->assertEquals(
$expected,
$results->first()->_matchingData['articles']->toArray()
);
$this->assertNull($results->last()->_matchingData['articles']->id);
$this->assertEquals(
['name' => 'tag3'],
$results->first()->_matchingData['tags']->toArray()
);
}

/**
Expand Down

0 comments on commit 06eb7d3

Please sign in to comment.