Skip to content

Commit

Permalink
Asserting that tags index 0 and 1 marshalled correctly and are marked…
Browse files Browse the repository at this point in the history
… as isNew(). Asserting tags index 2 is not marked as isNew()
  • Loading branch information
cjquinn committed Apr 5, 2015
1 parent 75b88bd commit 291200b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tests/TestCase/ORM/MarshallerTest.php
Expand Up @@ -564,7 +564,6 @@ public function testOneBelongsToManyJoinDataAssociatedWithIds()
*/
public function testBelongsToManyWithMixedData()
{

$data = [
'title' => 'My title',
'body' => 'My content',
Expand Down Expand Up @@ -593,13 +592,18 @@ public function testBelongsToManyWithMixedData()
]
]);

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

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

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

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

/**
Expand Down

0 comments on commit 291200b

Please sign in to comment.