Conditions | 1 |
Paths | 1 |
Total Lines | 48 |
Code Lines | 31 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
14 | public function testReturnNonZeroExistCode() |
||
15 | { |
||
16 | /** @var TopCommand $topCommand */ |
||
17 | $topCommand = $this->getMockBuilder('Petrica\StatsdSystem\Model\TopCommand') |
||
18 | ->disableOriginalConstructor() |
||
19 | ->setMethods(array( |
||
20 | 'getCommand' |
||
21 | )) |
||
22 | ->getMock(); |
||
23 | |||
24 | $command = $this->getMockBuilder('Tivie\Command') |
||
25 | ->disableOriginalConstructor() |
||
26 | ->setMethods(array( |
||
27 | 'run' |
||
28 | )) |
||
29 | ->getMock(); |
||
30 | |||
31 | $result = $this->getMockBuilder('Tivie\Command\Result') |
||
32 | ->disableOriginalConstructor() |
||
33 | ->setMethods(array( |
||
34 | 'getExitCode', |
||
35 | 'getStdErr' |
||
36 | )) |
||
37 | ->getMock(); |
||
38 | |||
39 | /** |
||
40 | * Simulate command not found |
||
41 | */ |
||
42 | $result->method('getExitCode') |
||
43 | ->willReturn(1); |
||
44 | $result->method('getStdErr') |
||
45 | ->willReturn('Does not exist.'); |
||
46 | |||
47 | $command->expects($this->once()) |
||
48 | ->method('run') |
||
49 | ->willReturn($result); |
||
50 | |||
51 | $topCommand->expects($this->once()) |
||
|
|||
52 | ->method('getCommand') |
||
53 | ->willReturn($command); |
||
54 | |||
55 | $this->setExpectedException( |
||
56 | '\RuntimeException', |
||
57 | 'Command failed. Exit code 1, output Does not exist.' |
||
58 | ); |
||
59 | |||
60 | $topCommand->run(); |
||
61 | } |
||
62 | } |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.