Skip to content

Commit d2edb32

Browse files
committed
defineFunctionMock() should be static so that it can be used with @beforeClass
1 parent 99cc5b7 commit d2edb32

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

classes/PHPMock.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public function registerForTearDown(Deactivatable $deactivatable)
116116
* is doing this for you. But if the mock is defined after the first call in the
117117
* tested class, the tested class doesn't resolve to the mock. This is
118118
* documented in Bug #68541. You therefore have to define the namespaced
119-
* function before the first call (e.g. with @beforeClass).
119+
* function before the first call (e.g. with the beforeClass annotation).
120120
*
121121
* Defining the function has no side effects. If the function was
122122
* already defined this method does nothing.
@@ -127,7 +127,7 @@ public function registerForTearDown(Deactivatable $deactivatable)
127127
* @param string $namespace The function namespace.
128128
* @param string $name The function name.
129129
*/
130-
public function defineFunctionMock($namespace, $name)
130+
public static function defineFunctionMock($namespace, $name)
131131
{
132132
$functionMockBuilder = new MockBuilder();
133133
$functionMockBuilder->setNamespace($namespace)

tests/PHPMockTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ protected function disableMocks()
3434
*/
3535
public function testDefineFunctionMock()
3636
{
37-
$this->defineFunctionMock(__NAMESPACE__, "escapeshellcmd");
37+
self::defineFunctionMock(__NAMESPACE__, "escapeshellcmd");
3838
self::escapeshellcmd("foo");
3939

4040
$mock = $this->getFunctionMock(__NAMESPACE__, "escapeshellcmd");

0 commit comments

Comments
 (0)