コード例 #1
0
ファイル: FailConsoleListener.php プロジェクト: rtens/scrut
 public function onResult(TestName $test, TestResult $result)
 {
     parent::onResult($test, $result);
     $this->ran++;
     if ($result instanceof FailedTestResult) {
         $this->failed++;
         $failureSource = $result->getFailure()->getFailureSource();
         $this->printLine();
         $this->printLine("FAILED: " . $test);
         $this->printLine('   Source:');
         $this->printLine('      ' . $failureSource);
         if ($pos = strrpos($failureSource, ':')) {
             $file = substr($failureSource, 0, $pos);
             $line = substr($failureSource, $pos + 1);
             if (file_exists($file)) {
                 $content = explode("\n", file_get_contents($file));
                 if (array_key_exists($line - 1, $content)) {
                     $this->printLine('   Code:');
                     $this->printLine('      ' . trim($content[$line - 1]));
                 }
             }
         }
         $this->printLine('   Message:');
         $this->printNotEmptyLine('      ' . $result->getFailure()->getFailureMessage());
         $this->printNotEmptyLine('      ' . $result->getFailure()->getMessage());
     }
 }
コード例 #2
0
ファイル: MetricConsoleListener.php プロジェクト: rtens/scrut
 protected function onEnd()
 {
     parent::onEnd();
     $total = $this->getCurrentValue() - $this->startValue;
     $this->printLine();
     $this->printLine("Total " . $this->getMetricName() . ": " . $this->format($total));
     if ($total > $this->getThreshold()) {
         $this->printLine();
         $this->printLine("Top tests:");
         arsort($this->values);
         foreach (array_slice($this->values, 0, 5) as $test => $time) {
             $this->printLine($this->format($time, 5) . ' ' . $test);
         }
     }
 }
コード例 #3
0
 public function onResult(TestName $test, TestResult $result)
 {
     parent::onResult($test, $result);
     if ($result instanceof IncompleteTestResult) {
         $this->print_('I');
     } else {
         if ($result instanceof FailedTestResult) {
             $this->print_('F');
         } else {
             if ($result instanceof PassedTestResult) {
                 $this->print_('.');
             } else {
                 $this->print_('?');
             }
         }
     }
 }
コード例 #4
0
 public function onResult(TestName $test, TestResult $result)
 {
     ConsoleListener::onResult($test, $result);
     $this->print_(' -> ' . self::shortResultClassName($result));
 }