Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ResultPrinter.php

function ResultPrinter::printThrowable

1 call to ResultPrinter::printThrowable()
ResultPrinter::printTestResultBody in vendor/phpunit/phpunit/src/TextUI/Output/TestDox/ResultPrinter.php

File

vendor/phpunit/phpunit/src/TextUI/Output/TestDox/ResultPrinter.php, line 140

Class

ResultPrinter
@no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit

Namespace

PHPUnit\TextUI\Output\TestDox

Code

private function printThrowable(TestDoxTestResult $test) : void {
    $throwable = $test->throwable();
    assert($throwable instanceof Throwable);
    $message = trim($throwable->description());
    $stackTrace = $this->formatStackTrace($throwable->stackTrace());
    $diff = '';
    if (!empty($message) && $this->colors) {
        [
            'message' => $message,
            'diff' => $diff,
        ] = $this->colorizeMessageAndDiff($message, $this->messageColorFor($test->status()));
    }
    if (!empty($message)) {
        $this->printer
            ->print($this->prefixLines($this->prefixFor('message', $test->status()), $message));
        $this->printer
            ->print(PHP_EOL);
    }
    if (!empty($diff)) {
        $this->printer
            ->print($this->prefixLines($this->prefixFor('diff', $test->status()), $diff));
        $this->printer
            ->print(PHP_EOL);
    }
    if (!empty($stackTrace)) {
        if (!empty($message) || !empty($diff)) {
            $prefix = $this->prefixFor('default', $test->status());
        }
        else {
            $prefix = $this->prefixFor('trace', $test->status());
        }
        $this->printer
            ->print($this->prefixLines($prefix, PHP_EOL . $stackTrace));
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal