Conditions | 1 |
Paths | 1 |
Total Lines | 40 |
Code Lines | 30 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
14 | public function testConfigure() |
||
15 | { |
||
16 | /** @var Command|\PHPUnit_Framework_MockObject_MockObject $stub */ |
||
17 | $stub = $this->getMockBuilder(BaseCommand::class) |
||
18 | ->disableOriginalConstructor() |
||
19 | ->setMethods(['addOption']) |
||
20 | ->getMock(); |
||
21 | |||
22 | $stub->expects($this->at(0)) |
||
|
|||
23 | ->method('addOption') |
||
24 | ->with( |
||
25 | 'key', |
||
26 | 'k', |
||
27 | InputOption::VALUE_OPTIONAL, |
||
28 | $this->anything() |
||
29 | ) |
||
30 | ->willReturn($stub); |
||
31 | |||
32 | $stub->expects($this->at(1)) |
||
33 | ->method('addOption') |
||
34 | ->with( |
||
35 | 'secret', |
||
36 | 's', |
||
37 | InputOption::VALUE_REQUIRED, |
||
38 | $this->anything() |
||
39 | ) |
||
40 | ->willReturn($stub); |
||
41 | |||
42 | $stub->expects($this->at(2)) |
||
43 | ->method('addOption') |
||
44 | ->with( |
||
45 | 'publicationId', |
||
46 | 'p', |
||
47 | InputOption::VALUE_REQUIRED, |
||
48 | $this->anything() |
||
49 | ) |
||
50 | ->willReturn($stub); |
||
51 | |||
52 | $this->invokeMethod($stub, 'configure'); |
||
53 | } |
||
54 | } |
||
55 |
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: