Skip to content

Commit

Permalink
Adding tests to show the key is present for a hasOne association usgin
Browse files Browse the repository at this point in the history
select strategy
  • Loading branch information
lorenzo committed Apr 10, 2014
1 parent 6517284 commit f2a2245
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/TestCase/ORM/QueryTest.php
Expand Up @@ -1957,4 +1957,20 @@ public function testConflitingAliases() {
->all();
}

/**
* Tests that a hasOne association using the select strategy will still have the
* key present in the results when no match is found
*
* @return void
*/
public function testAssociationKeyPresent() {
$table = TableRegistry::get('Articles');
$table->hasOne('ArticlesTags', ['strategy' => 'select']);
$article = $table->find()->where(['id' => 3])
->hydrate(false)
->contain('ArticlesTags')
->first();

$this->assertNull($article['articles_tag']);
}
}

0 comments on commit f2a2245

Please sign in to comment.