Esempio n. 1
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();
 }
Esempio n. 2
0
 /**
  * Run the test suite with the current directory.
  *
  * @param boolean $printDir print directory information
  */
 private function runTests($printDir = true)
 {
     $dir = '';
     if ($printDir) {
         $dir = "on directory <info>{$this->dir}</info>";
     }
     $this->output->writeln("Running Extension Pre Validator {$dir}.");
     $runner = new TestRunner($this->output, $this->dir, $this->debug);
     if ($this->debug) {
         $this->output->writelnIfDebug("tests to run:");
         foreach ($runner->tests as $t => $test) {
             $this->output->writelnIfDebug("<info>{$test}</info>");
         }
     }
     $runner->runTests();
 }