Conditions | 1 |
Paths | 1 |
Total Lines | 17 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
20 | public function testEventHandling() |
||
21 | { |
||
22 | /* @var EventSubscriberInterface|\PHPUnit_Framework_MockObject_MockObject $statusManager */ |
||
23 | $statusManager = $this->getMockBuilder('\Jalle19\StatusManager\Manager\StatusManager') |
||
24 | ->setConstructorArgs([$this->configuration, $this->logger, $this->eventDispatcher]) |
||
25 | ->setMethods(['onMainLoopStarted', 'onMainLoopTick']) |
||
26 | ->getMock(); |
||
27 | |||
28 | $statusManager->expects($this->once()) |
||
|
|||
29 | ->method('onMainLoopStarted'); |
||
30 | $statusManager->expects($this->once()) |
||
31 | ->method('onMainLoopTick'); |
||
32 | |||
33 | $this->eventDispatcher->addSubscriber($statusManager); |
||
34 | $this->eventDispatcher->dispatch(Events::MAIN_LOOP_STARTING); |
||
35 | $this->eventDispatcher->dispatch(Events::MAIN_LOOP_TICK); |
||
36 | } |
||
37 | |||
39 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: