public function testContainer() { $app = new Application('test', 'beta'); $app->configure(); $this->assertInstanceOf('Symfony\\Component\\Console\\Output\\OutputInterface', $app->getContainer()->get('console.output')); $this->assertInstanceOf('Psr\\Log\\LoggerInterface', $app->getContainer()->get('logger')); $this->assertInstanceOf('SugarCli\\Console\\Config', $app->getContainer()->get('config')); $this->assertTrue($app->getContainer()->get('config')->isLoaded()); }
/** * @expectedException InvalidArgumentException * @expectedExceptionMessageRegExp /The "\w+" option is not specified and not found in the config "sugarcrm\.\w+"/ */ public function testWrongDefaultOptionsOptionNotFound() { $cmd_name = 'test:default'; $config = new Config(array(__DIR__ . '/../yaml/empty.yaml')); $config->load(); $app = new Application(); $app->configure(); $app->setAutoExit(false); $app->getContainer()->set('config', $config); $app->add(new TestConfigOptionCommand($cmd_name)); $command = $app->find($cmd_name); $commandTester = new CommandTester($command); $commandTester->execute(array('command' => $cmd_name)); }