Conditions | 1 |
Paths | 1 |
Total Lines | 29 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
30 | public function testSetAndGet() |
||
31 | { |
||
32 | /** @var MockObject|LoggerInterface $logger */ |
||
33 | $logger = $this->getMock(Logger::class, ['log']); |
||
34 | $logger->expects($this->once()) |
||
|
|||
35 | ->method('log'); |
||
36 | |||
37 | $loggerAware = $this->buildMock(); |
||
38 | |||
39 | // Before logger instance set |
||
40 | $this->reflectionCall( |
||
41 | $loggerAware, |
||
42 | 'log', |
||
43 | [OperateType::GET, 'dummy', 'true'] |
||
44 | ); |
||
45 | |||
46 | // After logger instance set |
||
47 | $loggerAware->setLogger($logger); |
||
48 | $this->reflectionCall( |
||
49 | $loggerAware, |
||
50 | 'log', |
||
51 | [OperateType::GET, 'dummy', 'true'] |
||
52 | ); |
||
53 | |||
54 | $this->assertInstanceOf( |
||
55 | LoggerInterface::class, |
||
56 | $loggerAware->getLogger() |
||
57 | ); |
||
58 | } |
||
59 | } |
||
60 |
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: