| Conditions | 1 |
| Paths | 1 |
| Total Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | public function testExecute(): void { |
||
| 25 | /** |
||
| 26 | * @var $searchService SearchService|MockObject |
||
| 27 | */ |
||
| 28 | $searchService = $this->getMockBuilder(SearchService::class)->setMethods(array( |
||
| 29 | 'clearIndex', |
||
| 30 | ))->disableOriginalConstructor()->getMockForAbstractClass(); |
||
| 31 | |||
| 32 | $searchService->expects($this->once())->method('clearIndex'); |
||
|
|
|||
| 33 | |||
| 34 | $clearCommand = new ClearIndexCommand($searchService); |
||
| 35 | |||
| 36 | $application = new Application(); |
||
| 37 | $application->add($clearCommand); |
||
| 38 | |||
| 39 | $command = $application->find('stinger:search:clear'); |
||
| 40 | |||
| 41 | $commandTester = new CommandTester($command); |
||
| 42 | |||
| 43 | $commandTester->execute(array( |
||
| 44 | 'command' => 'stinger:search:clear', |
||
| 45 | )); |
||
| 46 | } |
||
| 47 | } |
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: