Skip to content

Commit da8b98a

Browse files
authored
Merge pull request #161 from bhoehl/wrong/method/invocation/count
wrong method invocation count on dynamic methods using exceptions
2 parents 3151da1 + a2592b6 commit da8b98a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/AspectMock/Core/Mocker.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class Mocker implements Aspect
1818
public function fakeMethodsAndRegisterCalls($class, $declaredClass, $method, $params, $static)
1919
{
2020
$result = __AM_CONTINUE__;
21+
$invocation = null;
2122

2223
if (in_array($method, $this->methodMap)) {
2324
$invocation = new \AspectMock\Intercept\MethodInvocation();
@@ -26,7 +27,6 @@ public function fakeMethodsAndRegisterCalls($class, $declaredClass, $method, $pa
2627
$invocation->setArguments($params);
2728
$invocation->isStatic($static);
2829
$invocation->setDeclaredClass($declaredClass);
29-
$result = $this->invokeFakedMethods($invocation);
3030
}
3131

3232
// Record actual method called, not faked method.
@@ -49,6 +49,10 @@ public function fakeMethodsAndRegisterCalls($class, $declaredClass, $method, $pa
4949
Registry::registerClassCall($declaredClass, $method, $params);
5050
}
5151

52+
if ($invocation instanceof \AspectMock\Intercept\MethodInvocation) {
53+
$result = $this->invokeFakedMethods($invocation);
54+
}
55+
5256
return $result;
5357
}
5458

0 commit comments

Comments
 (0)