protected function execute(InputInterface $input, OutputInterface $output) { $dir = $input->getOption("dir"); $git = $input->getOption('git'); $github = $input->getOption('github'); $branch = $input->getOption('branch'); if (!empty($github)) { $type = TestStartup::TYPE_GITHUB; $loc = $github; } else { if (!empty($git)) { $type = TestStartup::TYPE_GIT; $loc = $git; } else { if (!empty($dir)) { $type = TestStartup::TYPE_DIRECTORY; $loc = $dir; } else { throw new TestException("Or the git or the dir parameter are required"); } } } $debug = $input->getOption("debug"); $output = new Output($output, $debug); $output->setFormatter(new OutputFormatter(true)); new TestStartup($output, $type, $loc, $debug, $branch); if ($output->getFatalCount() > 0) { return 1; } return 0; }
/** * Run prevalidator. * * @param string $directory Directory where extracted revision is located * @return string */ public function run_epv($directory) { $int_output = new HtmlOutput(HtmlOutput::TYPE_BBCODE); $output = new Output($int_output, false); $runner = new TestRunner($output, $directory, false, true); $runner->runTests(); // Write a empty line $output->writeLn(''); $found_msg = ' '; $found_msg .= 'Fatal: ' . $output->getMessageCount(Output::FATAL); $found_msg .= ', Error: ' . $output->getMessageCount(Output::ERROR); $found_msg .= ', Warning: ' . $output->getMessageCount(Output::WARNING); $found_msg .= ', Notice: ' . $output->getMessageCount(Output::NOTICE); $found_msg .= ' '; if ($output->getMessageCount(Output::FATAL) > 0 || $output->getMessageCount(Output::ERROR) > 0 || $output->getMessageCount(Output::WARNING) > 0) { $output->writeln('<fatal>' . str_repeat(' ', strlen($found_msg)) . '</fatal>'); $output->writeln('<fatal> Validation: [b][color=#A91F1F]FAILED[/color][/b]' . str_repeat(' ', strlen($found_msg) - 19) . '</fatal>'); $output->writeln('<fatal>' . $found_msg . '</fatal>'); $output->writeln('<fatal>' . str_repeat(' ', strlen($found_msg)) . '</fatal>'); $output->writeln(''); } else { $output->writeln('<success>PASSED: ' . $found_msg . '</success>'); } $output->writeln("<info>Test results for extension:</info>"); $messages = $output->getMessages(); if (!empty($messages)) { $output->writeln('[list]'); } foreach ($messages as $msg) { $output->writeln('[*]' . (string) $msg); } if (!empty($messages)) { $output->writeln('[/list]'); } else { $output->writeln("<success>[color=#00BF40]No issues found[/color] </success>"); } return $int_output->getBuffer(); }