Author: David Grudl
Example #1
1
 public function end()
 {
     $jobCount = $this->runner->getJobCount();
     $results = $this->runner->getResults();
     $count = array_sum($results);
     echo !$jobCount ? "No tests found\n" : "\n\n" . $this->buffer . "\n" . ($results[Runner::FAILED] ? Dumper::color('white/red') . 'FAILURES!' : Dumper::color('white/green') . 'OK') . " ({$jobCount} test" . ($jobCount > 1 ? 's' : '') . ", " . ($results[Runner::FAILED] ? $results[Runner::FAILED] . ' failure' . ($results[Runner::FAILED] > 1 ? 's' : '') . ', ' : '') . ($results[Runner::SKIPPED] ? $results[Runner::SKIPPED] . ' skipped, ' : '') . ($jobCount !== $count ? $jobCount - $count . ' not run, ' : '') . sprintf('%0.1f', $this->time + microtime(TRUE)) . ' seconds)' . Dumper::color() . "\n";
     $this->buffer = NULL;
 }
Example #2
0
 public function end()
 {
     $jobCount = $this->runner->getJobCount();
     $results = $this->runner->getResults();
     $count = array_sum($results);
     fwrite($this->file, ($results[Runner::FAILED] ? 'FAILURES!' : 'OK') . " ({$jobCount} tests" . ($results[Runner::FAILED] ? ", {$results[Runner::FAILED]} failures" : '') . ($results[Runner::SKIPPED] ? ", {$results[Runner::SKIPPED]} skipped" : '') . ($jobCount !== $count ? ', ' . ($jobCount - $count) . ' not run' : '') . ')');
 }
Example #3
0
 public function end()
 {
     $results = $this->runner->getResults();
     $count = array_sum($results);
     $s = !$count ? "No tests found\n" : "\n\n" . $this->buffer . "\n" . ($results[Runner::FAILED] ? "FAILURES!" : "OK") . " ({$count} tests, " . ($results[Runner::FAILED] ? $results[Runner::FAILED] . ' failures, ' : '') . ($results[Runner::SKIPPED] ? $results[Runner::SKIPPED] . ' skipped, ' : '') . sprintf('%0.1f', $this->time + microtime(TRUE)) . " seconds)\n";
     echo Tester\Environment::$useColors ? $s : Tester\Dumper::removeColors($s);
     $this->buffer = NULL;
 }
Example #4
0
 public function end()
 {
     $jobCount = $this->runner->getJobCount();
     $results = $this->runner->getResults();
     $count = array_sum($results);
     echo !$jobCount ? "No tests found\n" : "\n\n" . $this->buffer . "\n" . ($results[Runner::FAILED] ? "FAILURES!" : "OK") . " ({$jobCount} test" . ($jobCount > 1 ? 's' : '') . ", " . ($results[Runner::FAILED] ? $results[Runner::FAILED] . ' failure' . ($results[Runner::FAILED] > 1 ? 's' : '') . ', ' : '') . ($results[Runner::SKIPPED] ? $results[Runner::SKIPPED] . ' skipped, ' : '') . ($jobCount !== $count ? $jobCount - $count . ' not run, ' : '') . sprintf('%0.1f', $this->time + microtime(TRUE)) . " seconds)\n";
     $this->buffer = NULL;
 }
 public function end()
 {
     $time = sprintf('%0.1f', microtime(TRUE) - $this->startTime);
     $output = $this->buffer;
     $results = $this->runner->getResults();
     $this->buffer = "\t<testsuite errors=\"{$results[3]}\" skipped=\"{$results[2]}\" tests=\"" . array_sum($results) . "\" time=\"{$time}\" timestamp=\"" . date('Y-m-d\\TH:i:s') . "\">\n";
     $this->buffer .= $output;
     $this->buffer .= "\t</testsuite>";
     fwrite($this->file, $this->buffer . "\n</testsuites>\n");
 }
Example #6
0
 private function assessHttpCode(Job $job, $code)
 {
     if (!$this->runner->getPhp()->isCgi()) {
         return;
     }
     $headers = $job->getHeaders();
     $actual = isset($headers['Status']) ? (int) $headers['Status'] : self::HTTP_OK;
     $code = (int) $code;
     if ($code && $code !== $actual) {
         return array(Runner::FAILED, "Exited with HTTP code {$actual} (expected {$code})");
     }
 }
Example #7
0
 /** @return void */
 private function watch(Runner $runner)
 {
     $prev = array();
     $counter = 0;
     while (TRUE) {
         $state = array();
         foreach ($this->options['--watch'] as $directory) {
             foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($directory)) as $file) {
                 if (substr($file->getExtension(), 0, 3) === 'php' && substr($file->getBasename(), 0, 1) !== '.') {
                     $state[(string) $file] = md5_file((string) $file);
                 }
             }
         }
         if ($state !== $prev) {
             $prev = $state;
             $runner->run();
         }
         echo "Watching " . implode(', ', $this->options['--watch']) . " " . str_repeat('.', ++$counter % 5) . "    \r";
         sleep(2);
     }
 }
Example #8
0
 public function end()
 {
     echo '1..' . array_sum($this->runner->getResults());
 }
Example #9
0
 public function end()
 {
     fwrite($this->file, '1..' . array_sum($this->runner->getResults()));
 }
Example #10
0
 public function end()
 {
     $results = $this->runner->getResults();
     fputs($this->file, ($results[Runner::FAILED] ? 'FAILURES!' : 'OK') . ' (' . array_sum($results) . ' tests' . ($results[Runner::FAILED] ? ", {$results[Runner::FAILED]} failures" : '') . ($results[Runner::SKIPPED] ? ", {$results[Runner::SKIPPED]} skipped" : '') . ')');
 }