PHPUnit_TextUI_ResultPrinter::printFooter PHP Méthode

printFooter() protected méthode

protected printFooter ( PHPUnit_Framework_TestResult $result )
$result PHPUnit_Framework_TestResult
    protected function printFooter(PHPUnit_Framework_TestResult $result)
    {
        if (count($result) === 0) {
            $this->writeWithColor('fg-black, bg-yellow', 'No tests executed!');
            return;
        }
        if ($result->wasSuccessful() && $result->allHarmless() && $result->allCompletelyImplemented() && $result->noneSkipped()) {
            $this->writeWithColor('fg-black, bg-green', sprintf('OK (%d test%s, %d assertion%s)', count($result), count($result) == 1 ? '' : 's', $this->numAssertions, $this->numAssertions == 1 ? '' : 's'));
        } else {
            if ($result->wasSuccessful()) {
                $color = 'fg-black, bg-yellow';
                if ($this->verbose) {
                    $this->write("\n");
                }
                $this->writeWithColor($color, 'OK, but incomplete, skipped, or risky tests!');
            } else {
                $this->write("\n");
                if ($result->errorCount()) {
                    $color = 'fg-white, bg-red';
                    $this->writeWithColor($color, 'ERRORS!');
                } elseif ($result->failureCount()) {
                    $color = 'fg-white, bg-red';
                    $this->writeWithColor($color, 'FAILURES!');
                } elseif ($result->warningCount()) {
                    $color = 'fg-black, bg-yellow';
                    $this->writeWithColor($color, 'WARNINGS!');
                }
            }
            $this->writeCountString(count($result), 'Tests', $color, true);
            $this->writeCountString($this->numAssertions, 'Assertions', $color, true);
            $this->writeCountString($result->errorCount(), 'Errors', $color);
            $this->writeCountString($result->failureCount(), 'Failures', $color);
            $this->writeCountString($result->warningCount(), 'Warnings', $color);
            $this->writeCountString($result->skippedCount(), 'Skipped', $color);
            $this->writeCountString($result->notImplementedCount(), 'Incomplete', $color);
            $this->writeCountString($result->riskyCount(), 'Risky', $color);
            $this->writeWithColor($color, '.', true);
        }
    }

Usage Example

 /**
  * Just add to the output the seed used to randomize the test suite.
  * 
  * @param  PHPUnit_Framework_TestResult $result
  */
 protected function printFooter(\PHPUnit_Framework_TestResult $result)
 {
     parent::printFooter($result);
     $this->writeNewLine();
     $this->write("Randomized with seed: {$this->seed}");
     $this->writeNewLine();
 }
All Usage Examples Of PHPUnit_TextUI_ResultPrinter::printFooter