We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6a35727 commit 1f67e1aCopy full SHA for 1f67e1a
classes/PHPMock.php
@@ -66,8 +66,13 @@ public function getFunctionMock($namespace, $name)
66
$delegateBuilder->build($name);
67
68
$builder = $this->getMockBuilder($delegateBuilder->getFullyQualifiedClassName());
69
+
70
+ // onlyMethods() and addMethods() were introduced in PHPUnit 8.3, addMethods() was deprecated in PHPUnit 11 and
71
+ // removed in PHPUnit 12
72
if (is_callable([$builder, 'onlyMethods'])) {
73
$builder->onlyMethods(['delegate', $name]);
74
+ } elseif (is_callable([$builder, 'addMethods'])) {
75
+ $builder->addMethods([$name]);
76
}
77
$mock = $builder->getMock();
78
$this->addMatcher($mock, $name);
0 commit comments