public function LogMessageParserTest::providerTestParseMessagePlaceholders in Zircon Profile 8
Same name and namespace in other branches
- 8.0 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 44 - Contains \Drupal\Tests\Core\Logger\LogMessageParserTest.
Class
- LogMessageParserTest
- @coversDefaultClass \Drupal\Core\Logger\LogMessageParser @group Logger
Namespace
Drupal\Tests\Core\LoggerCode
public function providerTestParseMessagePlaceholders() {
return array(
// PSR3 only message.
array(
array(
'message' => 'User {username} created',
'context' => array(
'username' => 'Dries',
),
),
array(
'message' => 'User @username created',
'context' => array(
'@username' => 'Dries',
),
),
),
// PSR3 style mixed in a format_string style message.
array(
array(
'message' => 'User {username} created @time',
'context' => array(
'username' => 'Dries',
'@time' => 'now',
),
),
array(
'message' => 'User @username created @time',
'context' => array(
'@username' => 'Dries',
'@time' => 'now',
),
),
),
// format_string style message only.
array(
array(
'message' => 'User @username created',
'context' => array(
'@username' => 'Dries',
),
),
array(
'message' => 'User @username created',
'context' => array(
'@username' => 'Dries',
),
),
),
// Message without placeholders but wildcard characters.
array(
array(
'message' => 'User W-\\};~{&! created @',
'context' => array(
'' => '',
),
),
array(
'message' => 'User W-\\};~{&! created @',
'context' => array(),
),
),
// Message with double PSR3 style messages.
array(
array(
'message' => 'Test {with} two {encapsuled} strings',
'context' => array(
'with' => 'together',
'encapsuled' => 'awesome',
),
),
array(
'message' => 'Test @with two @encapsuled strings',
'context' => array(
'@with' => 'together',
'@encapsuled' => 'awesome',
),
),
),
);
}