| Conditions | 1 |
| Paths | 1 |
| Total Lines | 26 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | public function testExecute() |
||
| 11 | { |
||
| 12 | $application = $this->getApplication(); |
||
| 13 | $application->add(new NotificationsCommand()); |
||
|
|
|||
| 14 | $application->setAutoExit(false); |
||
| 15 | $command = $this->getApplication()->find('admin:notifications'); |
||
| 16 | |||
| 17 | $commandTester = new CommandTester($command); |
||
| 18 | $commandTester->execute( |
||
| 19 | array( |
||
| 20 | 'command' => $command->getName(), |
||
| 21 | '--on' => true, |
||
| 22 | ) |
||
| 23 | ); |
||
| 24 | $this->assertRegExp('/Admin Notifications hidden/', $commandTester->getDisplay()); |
||
| 25 | |||
| 26 | $commandTester = new CommandTester($command); |
||
| 27 | $commandTester->execute( |
||
| 28 | array( |
||
| 29 | 'command' => $command->getName(), |
||
| 30 | '--off' => true, |
||
| 31 | ) |
||
| 32 | ); |
||
| 33 | |||
| 34 | $this->assertRegExp('/Admin Notifications visible/', $commandTester->getDisplay()); |
||
| 35 | } |
||
| 36 | } |
||
| 37 |
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: