You are here

public static function FileLogTest::tokenReplace in File Log 8

Same name and namespace in other branches
  1. 2.0.x tests/src/Unit/FileLogTest.php \Drupal\Tests\filelog\Unit\FileLogTest::tokenReplace()

A very primitive mock for the token service.

The full token integration is tested separately.

Parameters

string $text: The text to be replaced.

array $data: The placeholders.

Return value

string The formatted text.

File

tests/src/Unit/FileLogTest.php, line 233

Class

FileLogTest
Test the file logger.

Namespace

Drupal\Tests\filelog\Unit

Code

public static function tokenReplace($text, array $data) : string {

  /** @var \Drupal\filelog\LogMessage $message */
  $message = $data['log'];
  return strtr($text, [
    '[log:message]' => $message
      ->getText(),
    '[log:level]' => $message
      ->getLevel(),
  ]);
}