Skip to content

Commit

Permalink
Merge pull request #121 from wage-slave-montyakku/master
Browse files Browse the repository at this point in the history
入力値チェックの比較が不完全
  • Loading branch information
DavertMik authored Jan 31, 2017
2 parents c3971bb + 43b9452 commit 7a13a26
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions src/AspectMock/Proxy/Verifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ public function verifyInvokedMultipleTimes($name, $times, $params = null)
if (is_array($params)) {
$equals = 0;
foreach ($calls as $args) {
if ($this->onlyExpectedArguments($params, $args) == $params) $equals++;
if ($this->onlyExpectedArguments($params, $args) === $params) {
$equals++;
}
}
if ($equals == $times) return;
$params = ArgumentsFormatter::toString($params);
Expand Down Expand Up @@ -149,15 +151,21 @@ public function verifyNeverInvoked($name, $params = null)
$calls = $this->getCallsForMethod($name);
$separator = $this->callSyntax($name);

if (is_array($params)) {
if (empty($calls)) return;
$params = ArgumentsFormatter::toString($params);
foreach ($calls as $args) {
if ($this->onlyExpectedArguments($params, $args) == $params) throw new fail(sprintf($this->neverInvoked, $this->className));
}
return;
}
if (count($calls)) throw new fail(sprintf($this->neverInvoked, $this->className.$separator.$name));
if (is_array($params)) {
if (empty($calls)) {
return;
}
$params = ArgumentsFormatter::toString($params);
foreach ($calls as $args) {
if ($this->onlyExpectedArguments($params, $args) === $params) {
throw new fail(sprintf($this->neverInvoked, $this->className));
}
}
return;
}
if (count($calls)) {
throw new fail(sprintf($this->neverInvoked, $this->className.$separator.$name));
}
}

}

0 comments on commit 7a13a26

Please sign in to comment.