You are here

public function DbLogTest::testOverviewLinks in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/dblog/src/Tests/DbLogTest.php \Drupal\dblog\Tests\DbLogTest::testOverviewLinks()

Make sure HTML tags are filtered out in the log overview links.

File

core/modules/dblog/src/Tests/DbLogTest.php, line 735
Contains \Drupal\dblog\Tests\DbLogTest.

Class

DbLogTest
Generate events and verify dblog entries; verify user access to log reports based on permissions.

Namespace

Drupal\dblog\Tests

Code

public function testOverviewLinks() {
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->generateLogEntries(1, [
    'message' => "&lt;script&gt;alert('foo');&lt;/script&gt;<strong>Lorem</strong> ipsum dolor sit amet, consectetur adipiscing & elit.",
  ]);
  $this
    ->drupalGet('admin/reports/dblog');
  $this
    ->assertResponse(200);

  // Make sure HTML tags are filtered out.
  $this
    ->assertRaw('title="alert(&#039;foo&#039;);Lorem ipsum dolor sit amet, consectetur adipiscing &amp; elit. Entry #0">&lt;script&gt;alert(&#039;foo&#039;);&lt;/script&gt;Lorem ipsum dolor sit…</a>');
  $this
    ->assertNoRaw("<script>alert('foo');</script>");
}