Skip to content

Commit

Permalink
Fix loss of coverage.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Nov 17, 2017
1 parent d7d853c commit 47cf294
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions tests/TestCase/ORM/Association/HasManyTest.php
Expand Up @@ -929,12 +929,43 @@ public function testSaveAssociatedEmptySetWithReplaceStrategyRemovesAssociatedRe
*
* @return void
*/
public function testInvalidStrategy()
public function testInvalidSaveStrategy()
{
$this->expectException(\InvalidArgumentException::class);
$articles = TableRegistry::get('Articles');

$association = $articles->hasMany('Comments');
$association->setStrategy('anotherThing');
$association->setSaveStrategy('anotherThing');
}

/**
* Tests saveStrategy
*
* @return void
*/
public function testSetSaveStrategy()
{
$articles = TableRegistry::get('Articles');

$association = $articles->hasMany('Comments');
$this->assertSame($association, $association->setSaveStrategy(HasMany::SAVE_REPLACE));
$this->assertSame(HasMany::SAVE_REPLACE, $association->getSaveStrategy());
}

/**
* Tests saveStrategy
*
* @group deprecated
* @return void
*/
public function testSaveStrategy()
{
$this->deprecated(function () {
$articles = TableRegistry::get('Articles');

$association = $articles->hasMany('Comments');
$this->assertSame(HasMany::SAVE_REPLACE, $association->saveStrategy(HasMany::SAVE_REPLACE));
$this->assertSame(HasMany::SAVE_REPLACE, $association->saveStrategy());
});
}
}

0 comments on commit 47cf294

Please sign in to comment.