public function LogMessageParserTest::providerTestParseMessagePlaceholders in Drupal 8
Same name and namespace 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()
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',
],
],
],
];
}