1 | <?php |
||
16 | class MockeryMockingStrategy extends AbstractMockingStrategy |
||
17 | { |
||
18 | const CLASS_NAME = Mockery::class; |
||
19 | const PACKAGE_NAME = 'mockery/mockery'; |
||
20 | |||
21 | /** |
||
22 | * MockeryMockingStrategy constructor. |
||
23 | * |
||
24 | * @throws MissingDependencyException |
||
25 | */ |
||
26 | 2 | public function __construct() |
|
32 | |||
33 | /** |
||
34 | * @param string $fqcn |
||
35 | * @return MockInterface |
||
36 | */ |
||
37 | 26 | protected function doBuild(string $fqcn) |
|
41 | |||
42 | /** |
||
43 | * @param MockInterface $mock |
||
44 | * @param MethodStub $stub |
||
45 | * @return void |
||
46 | */ |
||
47 | 25 | protected function doDecorateWithMethod($mock, MethodStub $stub) |
|
48 | { |
||
49 | 25 | $methodName = $stub->getName(); |
|
50 | 25 | $methodValue = $stub->getValue(); |
|
51 | |||
52 | /** @noinspection PhpMethodParametersCountMismatchInspection */ |
||
53 | 25 | $partial = $mock->shouldReceive($methodName)->zeroOrMoreTimes(); |
|
54 | 25 | $methodValue instanceof \Throwable |
|
55 | 25 | ? $partial->andThrow($methodValue) |
|
56 | 25 | : $partial->andReturn($methodValue); |
|
57 | } |
||
58 | |||
59 | /** |
||
60 | * @param MockInterface $mock |
||
61 | * @return MockInterface |
||
62 | */ |
||
63 | 15 | protected function doGet($mock) |
|
67 | } |
||
68 |