function DbLogTest::verifyLinkEscaping
Tests link escaping 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 450 
Class
- DbLogTest
- Verifies log entries and user access based on permissions.
Namespace
Drupal\Tests\dblog\FunctionalCode
private function verifyLinkEscaping() : void {
  $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);
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
