function HtmlOutputPrinterTrait::simpletestUiWrite

Same name and namespace in other branches
  1. 8.9.x core/tests/Drupal/Tests/Listeners/HtmlOutputPrinterTrait.php \Drupal\Tests\Listeners\HtmlOutputPrinterTrait::simpletestUiWrite()

Prints HTML output links for the Simpletest UI.

1 call to HtmlOutputPrinterTrait::simpletestUiWrite()
SimpletestUiPrinter::write in core/tests/Drupal/Tests/Listeners/SimpletestUiPrinter.php

File

core/tests/Drupal/Tests/Listeners/HtmlOutputPrinterTrait.php, line 86

Class

HtmlOutputPrinterTrait
Defines a class for providing html output results for functional tests.

Namespace

Drupal\Tests\Listeners

Code

public function simpletestUiWrite($buffer) {
    $buffer = Html::escape($buffer);
    // Turn HTML output URLs into clickable link <a> tags.
    $url_pattern = '@https?://[^\\s]+@';
    $buffer = preg_replace($url_pattern, '<a href="$0" target="_blank" title="$0">$0</a>', $buffer);
    // Make the output readable in HTML by breaking up lines properly.
    $buffer = nl2br($buffer);
    print $buffer;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.