function DbLogTest::testBacktrace
Same name in other branches
- 8.9.x core/modules/dblog/tests/src/Functional/DbLogTest.php \Drupal\Tests\dblog\Functional\DbLogTest::testBacktrace()
- 10 core/modules/dblog/tests/src/Functional/DbLogTest.php \Drupal\Tests\dblog\Functional\DbLogTest::testBacktrace()
- 11.x core/modules/dblog/tests/src/Functional/DbLogTest.php \Drupal\Tests\dblog\Functional\DbLogTest::testBacktrace()
Tests that the details page displays correctly backtrace.
File
-
core/
modules/ dblog/ tests/ src/ Functional/ DbLogTest.php, line 910
Class
- DbLogTest
- Verifies log entries and user access based on permissions.
Namespace
Drupal\Tests\dblog\FunctionalCode
public function testBacktrace() {
$this->drupalLogin($this->adminUser);
$this->drupalGet('/error-test/generate-warnings');
$query = Database::getConnection()->select('watchdog');
$query->addExpression('MAX([wid])');
$wid = $query->execute()
->fetchField();
$this->drupalGet('admin/reports/dblog/event/' . $wid);
$error_user_notice = [
'%type' => 'User warning',
'@message' => 'Drupal & awesome',
'%function' => ErrorTestController::class . '->generateWarnings()',
'%file' => $this->getModulePath('error_test') . '/error_test.module',
];
// Check if the full message displays on the details page and backtrace is a
// pre-formatted text.
$message = new FormattableMarkup('%type: @message in %function (line', $error_user_notice);
$this->assertSession()
->responseContains($message);
$this->assertSession()
->responseContains('<pre class="backtrace">');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.