Пример #1
0
 /**
  * @param  PHPUnit_Framework_TestResult  $result
  * @access protected
  */
 protected function printFooter(PHPUnit_Framework_TestResult $result)
 {
     if ($result->wasSuccessful() && $result->allCompletlyImplemented() && $result->noneSkipped()) {
         $this->write("\n" . ($result = sprintf("OK (%d test%s, %d assertion%s)", count($result), count($result) == 1 ? '' : 's', $this->numAssertions, $this->numAssertions == 1 ? '' : 's')) . str_repeat(' ', 80 - strlen($result)) . "\n");
     } elseif ((!$result->allCompletlyImplemented() || !$result->noneSkipped()) && $result->wasSuccessful()) {
         $this->write("\nOk, but incomplete or skipped tests!                                            \n" . sprintf("Tests: %d, Assertions: %d%s%s.\n", count($result), $this->numAssertions, $this->getCountString($result->notImplementedCount(), 'Incomplete'), $this->getCountString($result->skippedCount(), 'Skipped')));
     } else {
         $this->write(sprintf("\nFailures                                                                        \n" . "Tests: %d, Assertions: %s%s%s%s.\n", count($result), $this->numAssertions, $this->getCountString($result->failureCount(), 'Failures'), $this->getCountString($result->errorCount(), 'Errors'), $this->getCountString($result->notImplementedCount(), 'Incomplete'), $this->getCountString($result->skippedCount(), 'Skipped')));
     }
 }
Пример #2
0
 /**
  * @param  PHPUnit_Framework_TestResult  $result
  */
 protected function printFooter(PHPUnit_Framework_TestResult $result)
 {
     if ($result->wasSuccessful() && $result->allCompletlyImplemented() && $result->noneSkipped()) {
         if ($this->colors) {
             $this->write("");
         }
         $this->write(sprintf("OK (%d test%s, %d assertion%s)\n", count($result), count($result) == 1 ? '' : 's', $this->numAssertions, $this->numAssertions == 1 ? '' : 's'));
         if ($this->colors) {
             $this->write("");
         }
     } else {
         if ((!$result->allCompletlyImplemented() || !$result->noneSkipped()) && $result->wasSuccessful()) {
             if ($this->colors) {
                 $this->write("OK, but incomplete or skipped tests!\n" . "");
             } else {
                 $this->write("OK, but incomplete or skipped tests!\n");
             }
             $this->write(sprintf("Tests: %d, Assertions: %d%s%s.\n", count($result), $this->numAssertions, $this->getCountString($result->notImplementedCount(), 'Incomplete'), $this->getCountString($result->skippedCount(), 'Skipped')));
             if ($this->colors) {
                 $this->write("");
             }
         } else {
             $this->write("\n");
             if ($this->colors) {
                 $this->write("FAILURES!\n");
             } else {
                 $this->write("FAILURES!\n");
             }
             $this->write(sprintf("Tests: %d, Assertions: %s%s%s%s%s.\n", count($result), $this->numAssertions, $this->getCountString($result->failureCount(), 'Failures'), $this->getCountString($result->errorCount(), 'Errors'), $this->getCountString($result->notImplementedCount(), 'Incomplete'), $this->getCountString($result->skippedCount(), 'Skipped')));
             if ($this->colors) {
                 $this->write("");
             }
         }
     }
     if (!$this->verbose && $result->deprecatedFeaturesCount() > 0) {
         $message = sprintf("Warning: Deprecated PHPUnit features are being used %s times!\n" . "Use --verbose for more information.\n", $result->deprecatedFeaturesCount());
         if ($this->colors) {
             $message = "" . $message . "";
         }
         $this->write("\n" . $message);
     }
 }
Пример #3
0
 /**
  * @param  PHPUnit_Framework_TestResult  $result
  */
 protected function printFooter(PHPUnit_Framework_TestResult $result)
 {
     if ($result->wasSuccessful() && $result->allCompletlyImplemented() && $result->noneSkipped()) {
         if ($this->colors) {
             $this->write("");
         }
         $this->write(sprintf("OK (%d test%s, %d assertion%s)\n", count($result), count($result) == 1 ? '' : 's', $this->numAssertions, $this->numAssertions == 1 ? '' : 's'));
         if ($this->colors) {
             $this->write("");
         }
     } else {
         if ((!$result->allCompletlyImplemented() || !$result->noneSkipped()) && $result->wasSuccessful()) {
             if ($this->colors) {
                 $this->write("OK, but incomplete or skipped tests!\n" . "");
             } else {
                 $this->write("OK, but incomplete or skipped tests!\n");
             }
             $this->write(sprintf("Tests: %d, Assertions: %d%s%s.\n", count($result), $this->numAssertions, $this->getCountString($result->notImplementedCount(), 'Incomplete'), $this->getCountString($result->skippedCount(), 'Skipped')));
             if ($this->colors) {
                 $this->write("");
             }
         } else {
             $this->write("\n");
             if ($this->colors) {
                 $this->write("FAILURES!\n");
             } else {
                 $this->write("FAILURES!\n");
             }
             $this->write(sprintf("Tests: %d, Assertions: %s%s%s%s%s.\n", count($result), $this->numAssertions, $this->getCountString($result->failureCount(), 'Failures'), $this->getCountString($result->errorCount(), 'Errors'), $this->getCountString($result->notImplementedCount(), 'Incomplete'), $this->getCountString($result->skippedCount(), 'Skipped')));
             if ($this->colors) {
                 $this->write("");
             }
         }
     }
 }
Пример #4
0
 /**
  * @param  PHPUnit_Framework_TestResult  $result
  * @access protected
  */
 protected function printFooter(PHPUnit_Framework_TestResult $result)
 {
     if ($result->wasSuccessful() && $result->allCompletlyImplemented() && $result->noneSkipped()) {
         $this->write(sprintf("\nOK (%d test%s)\n", count($result), count($result) == 1 ? '' : 's'));
     } else {
         if ((!$result->allCompletlyImplemented() || !$result->noneSkipped()) && $result->wasSuccessful()) {
             $this->write(sprintf("\nOK, but incomplete or skipped tests!\n" . "Tests: %d%s%s.\n", count($result), $this->getCountString($result->notImplementedCount(), 'Incomplete'), $this->getCountString($result->skippedCount(), 'Skipped')));
         } else {
             $this->write(sprintf("\nFAILURES!\n" . "Tests: %d%s%s%s%s.\n", count($result), $this->getCountString($result->failureCount(), 'Failures'), $this->getCountString($result->errorCount(), 'Errors'), $this->getCountString($result->notImplementedCount(), 'Incomplete'), $this->getCountString($result->skippedCount(), 'Skipped')));
         }
     }
 }
Пример #5
0
 public function printResult(\PHPUnit_Framework_TestResult $result)
 {
     $upLine = str_repeat($this->colors ? '▁' : '-', $this->maxColumns);
     $dnLine = str_repeat($this->colors ? '▔' : '-', $this->maxColumns);
     $arrow = $this->colors ? '❯' : '=>';
     $this->printFailures();
     if (!count($this->exceptions)) {
         $ch = $this->colors ? ' ✔' : '';
         $upLine = "" . $upLine . "\n";
         $dnLine = "" . $dnLine . "\n";
         $str = "{$ch} OK {$arrow} Passed %s of %s";
         $str = sprintf($str, count($result->passed()), $result->count());
     } else {
         $ch = $this->colors ? ' ✖' : '';
         $upLine = "" . $upLine . "\n";
         $dnLine = "" . $dnLine . "\n";
         $str = "{$ch} KO {$arrow} Failed %s of %s";
         $str = sprintf($str, $result->failureCount() + $result->errorCount(), $result->count());
     }
     if (!$result->allCompletlyImplemented()) {
         $pair = array();
         if ($result->notImplementedCount() > 0) {
             $pair[] = $result->notImplementedCount() . ' not implemented';
         }
         if ($result->skippedCount() > 0) {
             $pair[] = $result->skippedCount() . ' skipped';
         }
         $str .= " with " . implode(' and ', $pair);
     }
     // Calculate time and peak memory usage
     $time = number_format($result->time(), 2);
     $mem = memory_get_peak_usage();
     $mem = round($mem / 1024 / 1024);
     // Add time spent
     $str .= " ({$time}s {$mem}Mb)\n";
     // Clean up the line above and print there
     $this->write("");
     $this->write($upLine);
     $this->write($str);
     $this->write($dnLine);
 }
 /**
  * @param  PHPUnit_Framework_TestResult  $result
  * @access protected
  */
 protected function printFooter(PHPUnit_Framework_TestResult $result)
 {
     if ($result->wasSuccessful() && $result->allCompletlyImplemented() && $result->noneSkipped()) {
         $this->write(sprintf("<tfoot><tr style='background-color: green'><td colspan='5'>OK (%d test%s)</td>/<tr></tfoot>", count($result), count($result) == 1 ? '' : 's'));
     } else {
         if ((!$result->allCompletlyImplemented() || !$result->noneSkipped()) && $result->wasSuccessful()) {
             $this->write(sprintf("<tfoot><tr style='background-color: yellow'><td colspan='5'>OK, but incomplete or skipped tests! Tests: %d%s%s.</td>/<tr></tfoot>", count($result), $this->getCountString($result->notImplementedCount(), 'Incomplete'), $this->getCountString($result->skippedCount(), 'Skipped')));
         } else {
             $this->write(sprintf("<tfoot><tr style='background-color: red'><td colspan='5'>FAILURES ! Tests: %d%s%s.</td>/<tr></tfoot>", count($result), $this->getCountString($result->failureCount(), 'Failures'), $this->getCountString($result->errorCount(), 'Errors'), $this->getCountString($result->notImplementedCount(), 'Incomplete'), $this->getCountString($result->skippedCount(), 'Skipped')));
         }
     }
     $this->write('</table>');
 }