function LogMessageParserTest::testParseMessagePlaceholders

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Logger/LogMessageParserTest.php \Drupal\Tests\Core\Logger\LogMessageParserTest::testParseMessagePlaceholders()
  2. 8.9.x core/tests/Drupal/Tests/Core/Logger/LogMessageParserTest.php \Drupal\Tests\Core\Logger\LogMessageParserTest::testParseMessagePlaceholders()
  3. 10 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 32

Class

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

Namespace

Drupal\Tests\Core\Logger

Code

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

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