Skip to content

Commit aea75b9

Browse files
committed
Fixing some broken tests
1 parent c5ae11b commit aea75b9

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

src/ORM/Table.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,7 +1597,7 @@ public function newEntity(array $data = [], array $options = []) {
15971597
*
15981598
* By default all the associations on this table will be hydrated. You can
15991599
* limit which associations are built, or include deeper associations
1600-
* using the associations parameter:
1600+
* using the options parameter:
16011601
*
16021602
* {{{
16031603
* $articles = $this->Articles->newEntities(
@@ -1627,7 +1627,7 @@ public function patchEntity(EntityInterface $entity, array $data, array $options
16271627
$options['associated'] = $this->_associations->keys();
16281628
}
16291629
$marshaller = $this->marshaller();
1630-
return $marshaller->merge($entity, $data, $associations);
1630+
return $marshaller->merge($entity, $data, $options);
16311631
}
16321632

16331633
/**

tests/TestCase/ORM/MarshallerTest.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public function testOneWithAdditionalName() {
202202
]
203203
];
204204
$marshall = new Marshaller($this->articles);
205-
$result = $marshall->one($data, ['Users']);
205+
$result = $marshall->one($data, ['associated' => ['Users']]);
206206

207207
$this->assertInstanceOf('Cake\ORM\Entity', $result);
208208
$this->assertTrue($result->dirty(), 'Should be a dirty entity.');
@@ -231,7 +231,7 @@ public function testOneAssociationsSingle() {
231231
]
232232
];
233233
$marshall = new Marshaller($this->articles);
234-
$result = $marshall->one($data, ['Users']);
234+
$result = $marshall->one($data, ['associated' => ['Users']]);
235235

236236
$this->assertEquals($data['title'], $result->title);
237237
$this->assertEquals($data['body'], $result->body);
@@ -265,7 +265,7 @@ public function testOneAssociationsMany() {
265265
]
266266
];
267267
$marshall = new Marshaller($this->articles);
268-
$result = $marshall->one($data, ['Comments']);
268+
$result = $marshall->one($data, ['associated' => ['Comments']]);
269269

270270
$this->assertEquals($data['title'], $result->title);
271271
$this->assertEquals($data['body'], $result->body);
@@ -298,7 +298,7 @@ public function testOneBelongsToManyJoinData() {
298298
];
299299
$marshall = new Marshaller($this->articles);
300300
$result = $marshall->one($data, [
301-
'Tags'
301+
'associated' => ['Tags']
302302
]);
303303

304304
$this->assertEquals($data['title'], $result->title);
@@ -352,7 +352,7 @@ public function testOneBelongsToManyJoinDataAssociated() {
352352
$articlesTags->belongsTo('Users');
353353

354354
$marshall = new Marshaller($this->articles);
355-
$result = $marshall->one($data, ['Tags._joinData.Users']);
355+
$result = $marshall->one($data, ['associated' => ['Tags._joinData.Users']]);
356356
$this->assertInstanceOf(
357357
'Cake\ORM\Entity',
358358
$result->tags[0]->_joinData->user,
@@ -386,7 +386,7 @@ public function testOneDeepAssociations() {
386386
]
387387
];
388388
$marshall = new Marshaller($this->comments);
389-
$result = $marshall->one($data, ['Articles.Users']);
389+
$result = $marshall->one($data, ['associated' => ['Articles.Users']]);
390390

391391
$this->assertEquals(
392392
$data['article']['title'],
@@ -441,7 +441,7 @@ public function testManyAssociations() {
441441
],
442442
];
443443
$marshall = new Marshaller($this->comments);
444-
$result = $marshall->many($data, ['Users']);
444+
$result = $marshall->many($data, ['associated' => ['Users']]);
445445

446446
$this->assertCount(2, $result);
447447
$this->assertInstanceOf('Cake\ORM\Entity', $result[0]);
@@ -468,23 +468,23 @@ public function testOneGenerateBelongsToManyEntitiesFromIds() {
468468
'tags' => ['_ids' => '']
469469
];
470470
$marshall = new Marshaller($this->articles);
471-
$result = $marshall->one($data, ['Tags']);
471+
$result = $marshall->one($data, ['associated' => ['Tags']]);
472472
$this->assertCount(0, $result->tags);
473473

474474
$data = [
475475
'title' => 'Haz tags',
476476
'body' => 'Some content here',
477477
'tags' => ['_ids' => false]
478478
];
479-
$result = $marshall->one($data, ['Tags']);
479+
$result = $marshall->one($data, ['associated' => ['Tags']]);
480480
$this->assertCount(0, $result->tags);
481481

482482
$data = [
483483
'title' => 'Haz tags',
484484
'body' => 'Some content here',
485485
'tags' => ['_ids' => null]
486486
];
487-
$result = $marshall->one($data, ['Tags']);
487+
$result = $marshall->one($data, ['associated' => ['Tags']]);
488488
$this->assertCount(0, $result->tags);
489489

490490
$data = [
@@ -493,7 +493,7 @@ public function testOneGenerateBelongsToManyEntitiesFromIds() {
493493
'tags' => ['_ids' => [1, 2, 3]]
494494
];
495495
$marshall = new Marshaller($this->articles);
496-
$result = $marshall->one($data, ['Tags']);
496+
$result = $marshall->one($data, ['associated' => ['Tags']]);
497497

498498
$this->assertCount(3, $result->tags);
499499
$this->assertInstanceOf('Cake\ORM\Entity', $result->tags[0]);
@@ -612,7 +612,7 @@ public function testMergeWithSingleAssociation() {
612612
]
613613
];
614614
$marshall = new Marshaller($this->articles);
615-
$marshall->merge($entity, $data, ['Users']);
615+
$marshall->merge($entity, $data, ['associated' => ['Users']]);
616616
$this->assertEquals('My Content', $entity->body);
617617
$this->assertSame($user, $entity->user);
618618
$this->assertEquals('mark', $entity->user->username);
@@ -639,7 +639,7 @@ public function testMergeCreateAssociation() {
639639
]
640640
];
641641
$marshall = new Marshaller($this->articles);
642-
$marshall->merge($entity, $data, ['Users']);
642+
$marshall->merge($entity, $data, ['associated' => ['Users']]);
643643
$this->assertEquals('My Content', $entity->body);
644644
$this->assertInstanceOf('Cake\ORM\Entity', $entity->user);
645645
$this->assertEquals('mark', $entity->user->username);
@@ -680,7 +680,7 @@ public function testMergeMultipleAssociations() {
680680
]
681681
];
682682
$marshall = new Marshaller($this->articles);
683-
$result = $marshall->merge($entity, $data, ['Users', 'Comments']);
683+
$result = $marshall->merge($entity, $data, ['associated' => ['Users', 'Comments']]);
684684
$this->assertSame($entity, $result);
685685
$this->assertSame($user, $result->user);
686686
$this->assertEquals('not so secret', $entity->user->password);
@@ -724,7 +724,7 @@ public function testMergeBelongsToManyEntitiesFromIds() {
724724
];
725725
$entity->accessible('*', true);
726726
$marshall = new Marshaller($this->articles);
727-
$result = $marshall->merge($entity, $data, ['Tags']);
727+
$result = $marshall->merge($entity, $data, ['associated' => ['Tags']]);
728728

729729
$this->assertCount(3, $result->tags);
730730
$this->assertInstanceOf('Cake\ORM\Entity', $result->tags[0]);
@@ -754,21 +754,21 @@ public function testMergeBelongsToManyEntitiesFromIdsEmptyValue() {
754754
];
755755
$entity->accessible('*', true);
756756
$marshall = new Marshaller($this->articles);
757-
$result = $marshall->merge($entity, $data, ['Tags']);
757+
$result = $marshall->merge($entity, $data, ['associated' => ['Tags']]);
758758
$this->assertCount(0, $result->tags);
759759

760760
$data = [
761761
'title' => 'Haz moar tags',
762762
'tags' => ['_ids' => false]
763763
];
764-
$result = $marshall->merge($entity, $data, ['Tags']);
764+
$result = $marshall->merge($entity, $data, ['associated' => ['Tags']]);
765765
$this->assertCount(0, $result->tags);
766766

767767
$data = [
768768
'title' => 'Haz moar tags',
769769
'tags' => ['_ids' => null]
770770
];
771-
$result = $marshall->merge($entity, $data, ['Tags']);
771+
$result = $marshall->merge($entity, $data, ['associated' => ['Tags']]);
772772
$this->assertCount(0, $result->tags);
773773
}
774774

@@ -864,7 +864,7 @@ public function testMergeJoinDataAssociations() {
864864
$articlesTags = TableRegistry::get('ArticlesTags');
865865
$articlesTags->belongsTo('Users');
866866

867-
$options = ['Tags._joinData.Users'];
867+
$options = ['associated' => ['Tags._joinData.Users']];
868868
$marshall = new Marshaller($this->articles);
869869
$entity = $marshall->one($data, $options);
870870
$entity->accessible('*', true);

0 commit comments

Comments
 (0)