Skip to content

Commit

Permalink
Merge pull request #762 from robertbasic/fix/issue755
Browse files Browse the repository at this point in the history
Fix/issue755
  • Loading branch information
davedevelopment committed Jun 22, 2017
2 parents a162bb1 + e910927 commit 52cb8bf
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion library/Mockery/Matcher/AnyOf.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class AnyOf extends MatcherAbstract
public function match(&$actual)
{
foreach ($this->_expected as $exp) {
if ($actual === $exp || $actual == $exp) {
if ($actual === $exp) {
return true;
}
}
Expand Down
20 changes: 20 additions & 0 deletions tests/Mockery/ExpectationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1867,6 +1867,26 @@ public function testAnyOfConstraintThrowsExceptionWhenConstraintUnmatched()
$this->container->mockery_verify();
}

/**
* @expectedException \Mockery\Exception
*/
public function testAnyOfConstraintThrowsExceptionWhenTrueIsNotAnExpectedArgument()
{
$this->mock->shouldReceive('foo')->with(Mockery::anyOf(1, 2))->once();
$this->mock->foo(true);
$this->container->mockery_verify();
}

/**
* @expectedException \Mockery\Exception
*/
public function testAnyOfConstraintThrowsExceptionWhenFalseIsNotAnExpectedArgument()
{
$this->mock->shouldReceive('foo')->with(Mockery::anyOf(0, 1, 2))->once();
$this->mock->foo(false);
$this->container->mockery_verify();
}

public function testNotAnyOfConstraintMatchesArgument()
{
$this->mock->shouldReceive('foo')->with(Mockery::notAnyOf(1, 2))->once();
Expand Down

0 comments on commit 52cb8bf

Please sign in to comment.