/** * @inheritDoc */ protected function execute(InputInterface $input, OutputInterface $output) { $logger = $this->getLogger($input->getOption('log'), $output->getVerbosity()); //If it crash here it will just crash without fancy-pancy error message, sorry! $logger->info('Starting ' . ConsoleApplication::NAME . ' v' . ConsoleApplication::VERSION); if (version_compare(PHP_VERSION, '5.5.0', '<')) { $logger->warning('You\'re using outdated version of PHP (v' . PHP_VERSION . '). ' . ConsoleApplication::NAME . ' should work, but may be unstable or you may experience bugs. It\'s recommended to upgrade your ' . 'system. See http://php.net/eol.php for further details.'); } try { //TODO handle POSIX signal to reload config (and these two lines should be than extracted to method) $configurationProvider = ConfigurationProvider::fromYamlFile($input->getOption('config'), $logger); $application = new Application($configurationProvider, $logger); $application->run(); } catch (\Exception $e) { $logger->emergency($this->getClassNameFromObject($e) . ': ' . $e->getMessage()); return self::POSIX_EXIT_ERROR; } $logger->info(ConsoleApplication::NAME . ' finished'); return self::POSIX_EXIT_OK; }
public function setUp() { $this->logger = $this->getMockBuilder('Psr\\Log\\LoggerInterface')->getMockForAbstractClass(); $this->subjectUnderTest = ConfigurationProvider::fromYamlFile(__DIR__ . '/../../doc/config.example.yml', $this->logger); }