3 namespace Drupal\Tests\Listeners;
5 use Drupal\Component\Utility\Html;
8 * Defines a class for providing html output links in the Simpletest UI.
10 class SimpletestUiPrinter extends HtmlOutputPrinter {
15 public function write($buffer) {
16 $buffer = Html::escape($buffer);
17 // Turn HTML output URLs into clickable link <a> tags.
18 $url_pattern = '@https?://[^\s]+@';
19 $buffer = preg_replace($url_pattern, '<a href="$0" target="_blank" title="$0">$0</a>', $buffer);
20 // Make the output readable in HTML by breaking up lines properly.
21 $buffer = nl2br($buffer);