Skip to content

Commit 72fc3d6

Browse files
authored
Merge pull request #160 from bhoehl/invocation/missing/asserts
missing assertions for method call invocations
2 parents da8b98a + 758413b commit 72fc3d6

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/AspectMock/Proxy/Verifier.php

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22
namespace AspectMock\Proxy;
3+
4+
use \PHPUnit\Framework\Assert;
35
use \PHPUnit\Framework\ExpectationFailedException as fail;
46
use AspectMock\Util\ArgumentsFormatter;
57

@@ -118,14 +120,18 @@ public function verifyInvokedMultipleTimes($name, $times, $params = null)
118120
$equals++;
119121
}
120122
}
121-
if ($equals == $times) return;
123+
if ($equals == $times) {
124+
Assert::assertTrue(true);
125+
return;
126+
}
122127
$params = ArgumentsFormatter::toString($params);
123128
throw new fail(sprintf($this->invokedMultipleTimesFail, $this->className.$separator.$name."($params)", $times, $equals));
124129
} else if(is_callable($params)) {
125130
$params($calls);
126131
}
127132
$num_calls = count($calls);
128133
if ($num_calls != $times) throw new fail(sprintf($this->invokedMultipleTimesFail, $this->className.$separator.$name, $times, $num_calls));
134+
Assert::assertTrue(true);
129135
}
130136

131137
/**
@@ -153,6 +159,7 @@ public function verifyNeverInvoked($name, $params = null)
153159

154160
if (is_array($params)) {
155161
if (empty($calls)) {
162+
Assert::assertTrue(true);
156163
return;
157164
}
158165

@@ -161,11 +168,13 @@ public function verifyNeverInvoked($name, $params = null)
161168
throw new fail(sprintf($this->neverInvoked, $this->className));
162169
}
163170
}
171+
Assert::assertTrue(true);
164172
return;
165173
}
166174
if (count($calls)) {
167175
throw new fail(sprintf($this->neverInvoked, $this->className.$separator.$name));
168176
}
177+
Assert::assertTrue(true);
169178
}
170179

171180
}

0 commit comments

Comments
 (0)