function DbLogTest::testBacktrace
Same name in other branches
- 9 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 880
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' => drupal_get_path('module', '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->assertRaw($message);
$this->assertRaw('<pre class="backtrace">');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.