function DbLogTest::verifyLinkEscaping

Same name in other branches
  1. 9 core/modules/dblog/tests/src/Functional/DbLogTest.php \Drupal\Tests\dblog\Functional\DbLogTest::verifyLinkEscaping()
  2. 8.9.x core/modules/dblog/tests/src/Functional/DbLogTest.php \Drupal\Tests\dblog\Functional\DbLogTest::verifyLinkEscaping()
  3. 11.x core/modules/dblog/tests/src/Functional/DbLogTest.php \Drupal\Tests\dblog\Functional\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 448

Class

DbLogTest
Verifies log entries and user access based on permissions.

Namespace

Drupal\Tests\dblog\Functional

Code

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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.