/** * {@inheritdoc} */ protected function initialize(InputInterface $input, OutputInterface $output) { $config = $input->getArgument(self::INPUT_KEY_CONFIG); $this->config->init($config); //@todo: interactively ask for config file $reset = $input->getOption(self::INPUT_KEY_RESET); if ($reset) { $output->writeln('Reset the current position of migration to start from the beginning'); $this->progress->reset(); } if ($output->getVerbosity() > 1) { $this->logManager->process($this->verbosityLevels[$output->getVerbosity()]); } else { $this->logManager->process(); } }
/** * @return void */ protected function optionVerbose() { $verbose = $this->getArg('verbose'); if (!empty($verbose)) { $this->logManager->process($verbose); } else { $this->logManager->process(); } }
public function testRunWithException2() { $this->shell->setRawArgs(['data', '--config', 'file/to/config.xml']); $this->logManager->expects($this->once())->method('process'); $mode = $this->getMock('\\Migration\\Mode\\Data', [], [], '', false); $mode->expects($this->any())->method('run')->willThrowException(new \Migration\Exception('test error message')); $this->modeFactory->expects($this->once())->method('create')->with('data')->willReturn($mode); $this->logger->expects($this->once())->method('error')->with($this->stringContains('test error message')); $this->shell->run(); }
/** * @param mixed $forceLogLevel * @return bool */ protected function canRun($forceLogLevel) { $canRun = false; if ($forceLogLevel == LogManager::LOG_LEVEL_DEBUG && $this->logManager->getLogLevel() == LogManager::LOG_LEVEL_DEBUG) { $canRun = true; } else { if ($forceLogLevel == LogManager::LOG_LEVEL_INFO && $this->logManager->getLogLevel() == LogManager::LOG_LEVEL_INFO) { $canRun = true; } else { if ($forceLogLevel === false) { $canRun = true; } } } return $canRun; }