Skip to content

Commit 7a13a26

Browse files
authored
Merge pull request #121 from wage-slave-montyakku/master
入力値チェックの比較が不完全
2 parents c3971bb + 43b9452 commit 7a13a26

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

src/AspectMock/Proxy/Verifier.php

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ public function verifyInvokedMultipleTimes($name, $times, $params = null)
114114
if (is_array($params)) {
115115
$equals = 0;
116116
foreach ($calls as $args) {
117-
if ($this->onlyExpectedArguments($params, $args) == $params) $equals++;
117+
if ($this->onlyExpectedArguments($params, $args) === $params) {
118+
$equals++;
119+
}
118120
}
119121
if ($equals == $times) return;
120122
$params = ArgumentsFormatter::toString($params);
@@ -149,15 +151,21 @@ public function verifyNeverInvoked($name, $params = null)
149151
$calls = $this->getCallsForMethod($name);
150152
$separator = $this->callSyntax($name);
151153

152-
if (is_array($params)) {
153-
if (empty($calls)) return;
154-
$params = ArgumentsFormatter::toString($params);
155-
foreach ($calls as $args) {
156-
if ($this->onlyExpectedArguments($params, $args) == $params) throw new fail(sprintf($this->neverInvoked, $this->className));
157-
}
158-
return;
159-
}
160-
if (count($calls)) throw new fail(sprintf($this->neverInvoked, $this->className.$separator.$name));
154+
if (is_array($params)) {
155+
if (empty($calls)) {
156+
return;
157+
}
158+
$params = ArgumentsFormatter::toString($params);
159+
foreach ($calls as $args) {
160+
if ($this->onlyExpectedArguments($params, $args) === $params) {
161+
throw new fail(sprintf($this->neverInvoked, $this->className));
162+
}
163+
}
164+
return;
165+
}
166+
if (count($calls)) {
167+
throw new fail(sprintf($this->neverInvoked, $this->className.$separator.$name));
168+
}
161169
}
162170

163171
}

0 commit comments

Comments
 (0)