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

Breadcrumb

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

function ResultPrinter::formatStackTrace

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

File

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

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 formatStackTrace(string $stackTrace) : string {
    if (!$this->colors) {
        return rtrim($stackTrace);
    }
    $lines = [];
    $previousPath = '';
    foreach (explode(PHP_EOL, $stackTrace) as $line) {
        if (preg_match('/^(.*):(\\d+)$/', $line, $matches)) {
            $lines[] = Color::colorizePath($matches[1], $previousPath) . Color::dim(':') . Color::colorize('fg-blue', $matches[2]) . "\n";
            $previousPath = $matches[1];
            continue;
        }
        $lines[] = $line;
        $previousPath = '';
    }
    return rtrim(implode('', $lines));
}
RSS feed
Powered by Drupal