function DbLogTest::testMessageParsing
Same name in other branches
- 9 core/modules/dblog/tests/src/Functional/DbLogTest.php \Drupal\Tests\dblog\Functional\DbLogTest::testMessageParsing()
- 10 core/modules/dblog/tests/src/Functional/DbLogTest.php \Drupal\Tests\dblog\Functional\DbLogTest::testMessageParsing()
Test that twig errors are displayed correctly.
1 call to DbLogTest::testMessageParsing()
- DbLogTest::testDbLog in core/
modules/ dblog/ tests/ src/ Functional/ DbLogTest.php - Tests Database Logging module functionality through interfaces.
File
-
core/
modules/ dblog/ tests/ src/ Functional/ DbLogTest.php, line 286
Class
- DbLogTest
- Verifies log entries and user access based on permissions.
Namespace
Drupal\Tests\dblog\FunctionalCode
protected function testMessageParsing() : void {
$this->drupalLogin($this->adminUser);
// Log a common twig error with {{ }} and { } variables.
\Drupal::service('logger.factory')->get("php")
->error('Incorrect parameter {{foo}} in path {path}: {value}', [
'foo' => 'bar',
'path' => '/baz',
'value' => 'horse',
]);
// View the log page to verify it's correct.
$query = Database::getConnection()->select('watchdog');
$query->addExpression('MAX([wid])');
$wid = $query->execute()
->fetchField();
$this->drupalGet('admin/reports/dblog/event/' . $wid);
$this->assertSession()
->responseContains('Incorrect parameter {bar} in path /baz: horse');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.