Created
July 31, 2014 04:16
-
-
Save markstory/2c57e14321fbc00ba343 to your computer and use it in GitHub Desktop.
Trying to reproduce the issue José was talking about.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Tests that patchEntity includes _joinData | |
* all associations | |
* | |
* @return void | |
*/ | |
public function testPatchEntityJoinData() { | |
$articles = TableRegistry::get('Articles'); | |
$articles->belongsToMany('Tags'); | |
$entity = new \Cake\ORM\Entity; | |
$data = [ | |
'title' => 'testing', | |
'tags' => [ | |
[ | |
'tag' => 'CakePHP', | |
'_joinData' => ['active' => 1] | |
], | |
[ | |
'tag' => 'Internet', | |
'_joinData' => ['active' => 1] | |
], | |
] | |
]; | |
$articles->patchEntity($entity, $data); | |
$this->assertInstanceOf('Cake\ORM\Entity', $entity->tags[0]->_joinData); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment