Esempio n. 1
0
 /**
  * Parses the clover XML file and spits out coverage results to the console.
  *
  * @param  InputInterface  $input
  * @param  OutputInterface $output
  * @return int
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     // Get options
     $project = $input->getOption('project');
     if ($input->getOption('file')) {
         $file = $input->getOption('file');
     } else {
         $file = '';
     }
     // First step : Analysing config
     $config_path = $input->getArgument('config');
     $guardian = new Guardian($config_path);
     $output->writeln(sprintf('Analysing config file : <info>%s</info>', $config_path));
     $output->write("\n");
     $output->writeln(sprintf('> Start SQL restore : <info>%s</info>', $project));
     $output->writeln('------------------------------');
     try {
         $guardian->restoreDatabase($project, $file);
     } catch (\Exception $e) {
         if ($e->getCode() == 0) {
             $style = 'error';
         } else {
             $style = 'comment';
         }
         $output->write(sprintf(' : <' . $style . '>%s</' . $style . '>', $e->getMessage()));
     }
     $output->write("\n");
     $output->writeln('Finished : <info>Done</info>');
 }