Skip to content

Commit

Permalink
Fix recording of faked methods (e.g. __call)
Browse files Browse the repository at this point in the history
This should fix goaop#24.
  • Loading branch information
501st-alpha1 committed Jan 5, 2016
1 parent 334c418 commit bcb384e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/AspectMock/Core/Mocker.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Mocker implements Aspect {
protected $objectMap = [];
protected $funcMap = [];
protected $methodMap = ['__call', '__callStatic'];
protected $dynamicMethods = ['__call', '__callStatic'];

public function fakeMethodsAndRegisterCalls($class, $declaredClass, $method, $params, $static)
{
Expand All @@ -27,6 +28,12 @@ public function fakeMethodsAndRegisterCalls($class, $declaredClass, $method, $pa
$result = $this->invokeFakedMethods($invocation);
}

// Record actual method called, not faked method.
if (in_array($method, $this->dynamicMethods)) {
$method = array_shift($params);
$params = array_shift($params);
}

if (!$static) {
if (isset($this->objectMap[spl_object_hash($class)])) Registry::registerInstanceCall($class, $method, $params);
$class = get_class($class);
Expand Down

0 comments on commit bcb384e

Please sign in to comment.