| Conditions | 4 |
| Paths | 1 |
| Total Lines | 29 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | public function test() |
||
| 12 | { |
||
| 13 | $userTest = new class($this->app) extends Test { |
||
|
|
|||
| 14 | public function testMock($frameworkTest) |
||
| 15 | { |
||
| 16 | $config = [ |
||
| 17 | [['name' => 'nekufa'], ['value' => 'nekufa!']], |
||
| 18 | [['name' => 'bazyaba'], function () { |
||
| 19 | return ['value' => 'bazyaba!']; |
||
| 20 | }], |
||
| 21 | [[], ['value' => 'anonymous!']], |
||
| 22 | ]; |
||
| 23 | foreach ($config as [$params, $value]) { |
||
| 24 | $this->mock('service.call', $params)->willReturn($value); |
||
| 25 | } |
||
| 26 | |||
| 27 | foreach ($config as [$params, $value]) { |
||
| 28 | $result = $this->dispatch('service.call', $params); |
||
| 29 | if (is_callable($value)) { |
||
| 30 | $value = $value(); |
||
| 31 | } |
||
| 32 | $frameworkTest->assertSame($result, $value); |
||
| 33 | } |
||
| 34 | } |
||
| 35 | }; |
||
| 36 | |||
| 37 | $userTest->setup(); |
||
| 38 | $userTest->testMock($this); |
||
| 39 | } |
||
| 40 | } |
||
| 41 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: