function LogMessageParserTest::providerTestParseMessagePlaceholders
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Logger/LogMessageParserTest.php \Drupal\Tests\Core\Logger\LogMessageParserTest::providerTestParseMessagePlaceholders()
- 10 core/tests/Drupal/Tests/Core/Logger/LogMessageParserTest.php \Drupal\Tests\Core\Logger\LogMessageParserTest::providerTestParseMessagePlaceholders()
- 11.x core/tests/Drupal/Tests/Core/Logger/LogMessageParserTest.php \Drupal\Tests\Core\Logger\LogMessageParserTest::providerTestParseMessagePlaceholders()
Data provider for testParseMessagePlaceholders().
File
-
core/
tests/ Drupal/ Tests/ Core/ Logger/ LogMessageParserTest.php, line 39
Class
- LogMessageParserTest
- @coversDefaultClass \Drupal\Core\Logger\LogMessageParser @group Logger
Namespace
Drupal\Tests\Core\LoggerCode
public function providerTestParseMessagePlaceholders() {
return [
// PSR3 only message.
[
[
'message' => 'User {username} created',
'context' => [
'username' => 'Dries',
],
],
[
'message' => 'User @username created',
'context' => [
'@username' => 'Dries',
],
],
],
// PSR3 style mixed in a format_string style message.
[
[
'message' => 'User {username} created @time',
'context' => [
'username' => 'Dries',
'@time' => 'now',
],
],
[
'message' => 'User @username created @time',
'context' => [
'@username' => 'Dries',
'@time' => 'now',
],
],
],
// format_string style message only.
[
[
'message' => 'User @username created',
'context' => [
'@username' => 'Dries',
],
],
[
'message' => 'User @username created',
'context' => [
'@username' => 'Dries',
],
],
],
// Message without placeholders but wildcard characters.
[
[
'message' => 'User W-\\};~{&! created @',
'context' => [
'' => '',
],
],
[
'message' => 'User W-\\};~{&! created @',
'context' => [],
],
],
// Message with double PSR3 style messages.
[
[
'message' => 'Test {with} two {encapsuled} strings',
'context' => [
'with' => 'together',
'encapsuled' => 'awesome',
],
],
[
'message' => 'Test @with two @encapsuled strings',
'context' => [
'@with' => 'together',
'@encapsuled' => 'awesome',
],
],
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.