-
Notifications
You must be signed in to change notification settings - Fork 118
/
Copy pathmocking-methods.php
21 lines (15 loc) · 1.07 KB
/
mocking-methods.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
class CasesHolderTest
{
public function method() {
$mock->method('method')-><warning descr="It probably was intended to use '->will(...)' here.">willReturn</warning>($this->returnCallback(function () {}));
$mock->method('method')-><warning descr="It probably was intended to use '->will(...)' here.">willReturn</warning>($this->returnValue('...'));
$mock = $this->getMockBuilder(CasesHolderTest::class)->getMock();
$mock->method(<error descr="The method is final hence can not be mocked.">'finalMethod'</error>)->willReturn(null);
$mock->method(<error descr="The method was not resolved, perhaps it doesn't exist.">'missingMethod'</error>)->willReturn(null);
$mock->expects()->method(<error descr="The method is final hence can not be mocked.">'finalMethod'</error>)->willReturn(null);
$mock->expects()->method(<error descr="The method was not resolved, perhaps it doesn't exist.">'missingMethod'</error>)->willReturn(null);
$mock->method('method')->willReturn(null);
}
final public function finalMethod() {}
}