Exemplo n.º 1
0
 public function run()
 {
     echo "ThreadUnit v" . self::VERSION . " by Michail Buylov. ";
     echo "A multithread wrapper of\n";
     exec("phpunit --version", $out, $exitCode);
     if ($exitCode) {
         throw new EnvironmentException("phpunit, that not found");
     }
     echo trim(implode("\n", $out)) . "\n";
     if ($this->params->needHelp()) {
         $this->params->displayHelp();
         return 0;
     }
     $testMap = new TestMap($this->params);
     $tests = $testMap->getWorkers();
     $tests->prepare();
     $startTime = microtime(1);
     do {
         $tests->tic();
     } while (!$tests->done());
     $execTime = round(microtime(1) - $startTime, 2);
     $pidCount = count($tests);
     $log = $testMap->getLogBuilder();
     $logPath = $this->params->getJlog();
     if ($logPath) {
         $log->save($logPath);
     }
     $log->echoStatus($pidCount, $execTime);
     return $log->getExitStatus();
 }