Skip to content

Commit

Permalink
Improving test case to disprove #3677
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Jun 13, 2014
1 parent 677ddfe commit 1f7d91c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions tests/TestCase/ORM/QueryRegressionTest.php
Expand Up @@ -193,6 +193,9 @@ public function testBelongsToManyDeepSave() {
'through' => 'SpecialTags'
]);
$articles->Highlights->junction()->belongsTo('Authors');
$articles->Highlights->hasOne('Authors', [
'foreignKey' => 'id'
]);
$entity = $articles->get(2, ['contain' => ['Highlights']]);

$data = [
Expand All @@ -205,20 +208,22 @@ public function testBelongsToManyDeepSave() {
'author' => [
'name' => 'jose'
]
]
],
'author' => ['name' => 'mark']
]
]
];
$entity = $articles->patchEntity($entity, $data, [
'Highlights' => ['associated' => ['_joinData' => ['associated' => ['Authors']]]]
'Highlights' => ['associated' => ['_joinData' => ['associated' => ['Authors']], 'Authors']]
]);
$articles->save($entity, [
'associated' => [
'Highlights' => ['associated' => ['_joinData' => ['associated' => ['Authors']]]]
'Highlights' => ['associated' => ['_joinData' => ['associated' => ['Authors']], 'Authors']]
]
]);
$entity = $articles->get(2, ['contain' => ['SpecialTags.Authors']]);
$entity = $articles->get(2, ['contain' => ['SpecialTags.Authors', 'Highlights.Authors']]);
$this->assertEquals('jose', $entity->special_tags[0]->author->name);
$this->assertEquals('mark', $entity->highlights[0]->author->name);
}

}

0 comments on commit 1f7d91c

Please sign in to comment.