You are here

public function LogMessageParserTest::testParseMessagePlaceholders in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Logger/LogMessageParserTest.php \Drupal\Tests\Core\Logger\LogMessageParserTest::testParseMessagePlaceholders()

Test for LogMessageParserTrait::parseMessagePlaceholders()

@dataProvider providerTestParseMessagePlaceholders @covers ::parseMessagePlaceholders

Parameters

array $value: An array containing:

  • message: A string that contains a message with placeholders.
  • context: An array with placeholder values.

array $expected: An array with the expected values after the test has run.

  • message: The expected parsed message.
  • context: The expected values of the placeholders.

File

core/tests/Drupal/Tests/Core/Logger/LogMessageParserTest.php, line 29

Class

LogMessageParserTest
@coversDefaultClass \Drupal\Core\Logger\LogMessageParser @group Logger

Namespace

Drupal\Tests\Core\Logger

Code

public function testParseMessagePlaceholders(array $value, array $expected) {
  $parser = new LogMessageParser();
  $message_placeholders = $parser
    ->parseMessagePlaceholders($value['message'], $value['context']);
  $this
    ->assertEquals($expected['message'], $value['message']);
  $this
    ->assertEquals($expected['context'], $message_placeholders);
}