Skip to content

Commit

Permalink
Adding explicit test for BTM strategy failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Conroy committed Mar 7, 2015
1 parent 6dca290 commit cedecc7
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions tests/TestCase/ORM/Association/BelongsToManyTest.php
Expand Up @@ -138,13 +138,19 @@ public function testRequiresKeys()
$this->assertFalse($assoc->requiresKeys());
$assoc->strategy(BelongsToMany::STRATEGY_SELECT);
$this->assertTrue($assoc->requiresKeys());
$errorUsingJoin = false;
try {
$assoc->strategy(BelongsToMany::STRATEGY_JOIN);
} catch (\InvalidArgumentException $e) {
$errorUsingJoin = true;
}
$this->assertTrue($errorUsingJoin);
}

/**
* Tests that BelongsToMany can't use the join strategy
*
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage Invalid strategy "join" was provided
* @return void
*/
public function testStrategyFailure()
{
$assoc = new BelongsToMany('Test');
$assoc->strategy(BelongsToMany::STRATEGY_JOIN);
}

/**
Expand Down

0 comments on commit cedecc7

Please sign in to comment.