private function DbLogTest::verifyLinkEscaping in Drupal 9
Same name and namespace in other branches
- 8 core/modules/dblog/tests/src/Functional/DbLogTest.php \Drupal\Tests\dblog\Functional\DbLogTest::verifyLinkEscaping()
- 10 core/modules/dblog/tests/src/Functional/DbLogTest.php \Drupal\Tests\dblog\Functional\DbLogTest::verifyLinkEscaping()
Tests the escaping of links in the operation row of a database log detail page.
1 call to DbLogTest::verifyLinkEscaping()
- 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 392
Class
- DbLogTest
- Generate events and verify dblog entries; verify user access to log reports based on permissions.
Namespace
Drupal\Tests\dblog\FunctionalCode
private function verifyLinkEscaping() {
$link = Link::fromTextAndUrl('View', Url::fromRoute('entity.node.canonical', [
'node' => 1,
]))
->toString();
$message = 'Log entry added to do the verifyLinkEscaping test.';
$this
->generateLogEntries(1, [
'message' => $message,
'link' => $link,
]);
$result = Database::getConnection()
->select('watchdog', 'w')
->fields('w', [
'wid',
])
->orderBy('wid', 'DESC')
->range(0, 1)
->execute();
$this
->drupalGet('admin/reports/dblog/event/' . $result
->fetchField());
// Check if the link exists (unescaped).
$this
->assertSession()
->responseContains($link);
}