Skip to content

Commit

Permalink
Merge pull request #161 from bhoehl/wrong/method/invocation/count
Browse files Browse the repository at this point in the history
wrong method invocation count on dynamic methods using exceptions
  • Loading branch information
Naktibalda committed Feb 29, 2020
2 parents 3151da1 + a2592b6 commit da8b98a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/AspectMock/Core/Mocker.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Mocker implements Aspect
public function fakeMethodsAndRegisterCalls($class, $declaredClass, $method, $params, $static)
{
$result = __AM_CONTINUE__;
$invocation = null;

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

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

if ($invocation instanceof \AspectMock\Intercept\MethodInvocation) {
$result = $this->invokeFakedMethods($invocation);
}

return $result;
}

Expand Down

0 comments on commit da8b98a

Please sign in to comment.