You are here

public function LogMessageParserTest::testParseMessagePlaceholders in Drupal 10

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

Tests 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);
}