Conditions | 1 |
Paths | 1 |
Total Lines | 37 |
Code Lines | 32 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
76 | public function testOrganiseArguments() |
||
77 | { |
||
78 | $this->functionMock->getParameters()->willReturn([ |
||
1 ignored issue
–
show
|
|||
79 | (object)['name' => 'scenarioBanana'], |
||
80 | (object)['name' => 'gorilla'], |
||
81 | (object)['name' => 'foo'], |
||
82 | ])->shouldBeCalledTimes(1); |
||
83 | |||
84 | $this->initializerMock->getStore()->willReturn($this->storeMock->reveal())->shouldBeCalledTimes(1); |
||
2 ignored issues
–
show
|
|||
85 | $this->readerMock->getMethodAnnotations($this->functionMock->reveal())->willReturn([ |
||
2 ignored issues
–
show
|
|||
86 | $this->annotationMock->reveal(), |
||
1 ignored issue
–
show
|
|||
87 | $this->annotationMock->reveal(), |
||
88 | ])->shouldBeCalledTimes(1); |
||
89 | $this->annotationMock->getArgument() |
||
1 ignored issue
–
show
|
|||
90 | ->willReturn('scenarioBanana', 'scenarioBanana', 'gorilla', 'gorilla') |
||
91 | ->shouldBeCalled(); |
||
92 | $this->annotationMock->getName() |
||
1 ignored issue
–
show
|
|||
93 | ->willReturn('scenarioBanana', 'scenarioBanana', 'scenarioBanana', 'scenarioGorilla', 'scenarioGorilla', 'scenarioGorilla') |
||
94 | ->shouldBeCalled(); |
||
95 | $this->storeMock->hasStateFragment('scenarioBanana')->willReturn(true)->shouldBeCalledTimes(1); |
||
1 ignored issue
–
show
|
|||
96 | $this->storeMock->hasStateFragment('scenarioGorilla')->willReturn(true)->shouldBeCalledTimes(1); |
||
97 | $this->storeMock->hasStateFragment('foo')->shouldNotBeCalled(); |
||
98 | $this->storeMock->getStateFragment('scenarioBanana')->willReturn('Yummy banana!')->shouldBeCalledTimes(2); |
||
1 ignored issue
–
show
|
|||
99 | $this->storeMock->getStateFragment('scenarioGorilla')->willReturn('Bonobo')->shouldBeCalledTimes(2); |
||
100 | $this->storeMock->getStateFragment('foo')->shouldNotBeCalled(); |
||
101 | |||
102 | $this->organiserMock->organiseArguments($this->functionMock->reveal(), [ |
||
1 ignored issue
–
show
|
|||
103 | 0 => 'scenarioBanana', |
||
104 | 1 => 'gorilla', |
||
105 | 'scenarioBanana' => 'Yummy banana!', |
||
106 | 2 => 'Yummy banana!', |
||
107 | 'gorilla' => 'Bonobo', |
||
108 | 3 => 'Bonobo', |
||
109 | ])->shouldBeCalledTimes(1); |
||
110 | |||
111 | $this->organiser->organiseArguments($this->functionMock->reveal(), ['scenarioBanana', 'gorilla']); |
||
112 | } |
||
113 | } |
||
114 |
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: