| Conditions | 1 |
| Paths | 1 |
| Total Lines | 23 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | public function testExecute(UnitTester $I): void |
||
| 17 | { |
||
| 18 | $app = new Application(); |
||
| 19 | $params = ApplicationDataProvider::getConsoleConfig()->get('params-console'); |
||
| 20 | |||
| 21 | $loader = new ContainerCommandLoader( |
||
| 22 | ApplicationDataProvider::getConsoleContainer(), |
||
| 23 | $params['yiisoft/yii-console']['commands'] |
||
| 24 | ); |
||
| 25 | |||
| 26 | $app->setCommandLoader($loader); |
||
| 27 | |||
| 28 | $command = $app->find('hello'); |
||
| 29 | |||
| 30 | $commandCreate = new CommandTester($command); |
||
| 31 | |||
| 32 | $commandCreate->setInputs(['yes']); |
||
| 33 | |||
| 34 | $I->assertSame(ExitCode::OK, $commandCreate->execute([])); |
||
| 35 | |||
| 36 | $output = $commandCreate->getDisplay(true); |
||
| 37 | |||
| 38 | $I->assertStringContainsString('Hello!', $output); |
||
| 39 | } |
||
| 41 |