config = $runner->getConfig(); $this->container = $runner->getContainer(); } public function testExecute(UnitTester $I): void { $app = new Application(); $params = $this->config->get('params-console'); $loader = new ContainerCommandLoader( $this->container, $params['yiisoft/yii-console']['commands'] ); $app->setCommandLoader($loader); $command = $app->find('hello'); $commandCreate = new CommandTester($command); $commandCreate->setInputs(['yes']); $I->assertSame(ExitCode::OK, $commandCreate->execute([])); $output = $commandCreate->getDisplay(true); $I->assertStringContainsString('Hello!', $output); } }