Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0891cb8

Browse files
committed
Replace usage of deprecated getMock()
PHPUnit-5.4 marked PHPUnit_Framework_TestCase::getMock() as deprecated. It suggests to replace that usage with either createMock() or getMockBuilder(). createMock() is only available since PHPUnit-5.4. This commit replaces the usage of getMock() with getMockBuilder() as it is also available in older PHPUnit versions.
1 parent 0ea5ece commit 0891cb8

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

‎tests/MockObjectProxyTest.php‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,30 @@
1616
*/
1717
class MockObjectProxyTest extends \PHPUnit_Framework_TestCase
1818
{
19-
19+
2020
/**
2121
* Tests expects()
2222
*
2323
* @test
2424
*/
2525
public function testExpects()
2626
{
27-
$matcher = $this->getMock(\PHPUnit_Framework_MockObject_Matcher_Invocation::class);
28-
29-
$invocationMocker = $this->getMock(InvocationMocker::class, [], [], '', false);
27+
$matcher = $this->getMockBuilder(\PHPUnit_Framework_MockObject_Matcher_Invocation::class)->getMock();
28+
29+
$invocationMocker = $this->getMockBuilder(InvocationMocker::class)->disableOriginalConstructor()->getMock();
3030
$invocationMocker->expects($this->once())->method("method")
3131
->with(MockDelegateFunctionBuilder::METHOD)->willReturn($invocationMocker);
32-
32+
3333
$prophecy = $this->prophesize(\PHPUnit_Framework_MockObject_MockObject::class);
3434
$prophecy->expects($matcher)->willReturn($invocationMocker);
3535
$mock = $prophecy->reveal();
36-
36+
3737
$proxy = new MockObjectProxy($mock);
38-
38+
3939
$result = $proxy->expects($matcher);
4040
$this->assertEquals($invocationMocker, $result);
4141
}
42-
42+
4343
/**
4444
* Tests delegation of __phpunit_hasMatchers().
4545
*
@@ -55,13 +55,13 @@ public function testHasMatcher()
5555
$prophecy = $this->prophesize(\PHPUnit_Framework_MockObject_MockObject::class);
5656
$prophecy->__phpunit_hasMatchers()->willReturn("foo");
5757
$mock = $prophecy->reveal();
58-
58+
5959
$proxy = new MockObjectProxy($mock);
60-
60+
6161
$result = $proxy->__phpunit_hasMatchers();
6262
$this->assertEquals("foo", $result);
6363
}
64-
64+
6565
/**
6666
* Tests calling the proxy forwards the call to the subject.
6767
*
@@ -76,9 +76,9 @@ public function testProxiedMethods($method, array $arguments = [], $expected = "
7676
$prophecy = $this->prophesize(\PHPUnit_Framework_MockObject_MockObject::class);
7777
call_user_func_array([$prophecy, $method], $arguments)->willReturn($expected);
7878
$mock = $prophecy->reveal();
79-
79+
8080
$proxy = new MockObjectProxy($mock);
81-
81+
8282
$result = call_user_func_array([$proxy, $method], $arguments);
8383
$this->assertEquals($expected, $result);
8484
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /