public function DbLogTest::testBacktrace in Drupal 9
Same name and namespace in other branches
- 8 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()
Tests that the details page displays correctly backtrace.
File
- core/
modules/ dblog/ tests/ src/ Functional/ DbLogTest.php, line 886
Class
- DbLogTest
- Generate events and verify dblog entries; verify user access to log reports 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">');
}