Skip to content

Commit

Permalink
Support Mockery::mock (#37)
Browse files Browse the repository at this point in the history
Fixes #36
  • Loading branch information
ruudk committed Jul 2, 2024
1 parent b2c4ffe commit 5c54cf1
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use PhpParser\Node\Arg;
use PhpParser\Node\Expr\ClassConstFetch;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\Identifier;
use PhpParser\Node\Name;
use PhpParser\NodeVisitorAbstract;
Expand All @@ -21,7 +22,7 @@ final class MockedClassNameCollectingNodeVisitor extends NodeVisitorAbstract

public function enterNode(Node $node)
{
if (! $node instanceof MethodCall) {
if (! $node instanceof MethodCall && ! $node instanceof StaticCall) {
return null;
}

Expand All @@ -31,7 +32,7 @@ public function enterNode(Node $node)
}

$methodName = $node->name->toString();
if (! in_array($methodName, ['getMock', 'createMock'], true)) {
if (! in_array($methodName, ['getMock', 'createMock', 'mock'], true)) {
return null;
}

Expand Down

0 comments on commit 5c54cf1

Please sign in to comment.