Skip to content

Commit 291200b

Browse files
committed
Asserting that tags index 0 and 1 marshalled correctly and are marked as isNew(). Asserting tags index 2 is not marked as isNew()
1 parent 75b88bd commit 291200b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tests/TestCase/ORM/MarshallerTest.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,6 @@ public function testOneBelongsToManyJoinDataAssociatedWithIds()
564564
*/
565565
public function testBelongsToManyWithMixedData()
566566
{
567-
568567
$data = [
569568
'title' => 'My title',
570569
'body' => 'My content',
@@ -593,13 +592,18 @@ public function testBelongsToManyWithMixedData()
593592
]
594593
]);
595594

595+
$this->assertEquals($data['tags'][0]['name'], $article->tags[0]->name);
596+
$this->assertEquals($data['tags'][1]['name'], $article->tags[1]->name);
596597
$this->assertEquals($article->tags[2], $tags->get(1));
597598

598-
$tag_count = $tags->find()->count();
599-
$articles->save($article);
599+
$this->assertEquals($article->tags[0]->isNew(), true);
600+
$this->assertEquals($article->tags[1]->isNew(), true);
601+
$this->assertEquals($article->tags[2]->isNew(), false);
600602

601-
$this->assertEquals($tag_count + 2, $tags->find()->count());
603+
$tagCount = $tags->find()->count();
604+
$articles->save($article);
602605

606+
$this->assertEquals($tagCount + 2, $tags->find()->count());
603607
}
604608

605609
/**

0 commit comments

Comments
 (0)