You are here

public function BlockXssTest::testBlockXss in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/block/tests/src/Functional/BlockXssTest.php \Drupal\Tests\block\Functional\BlockXssTest::testBlockXss()

Tests various modules that provide blocks for XSS.

File

core/modules/block/tests/src/Functional/BlockXssTest.php, line 85

Class

BlockXssTest
Tests that the block module properly escapes block descriptions.

Namespace

Drupal\Tests\block\Functional

Code

public function testBlockXss() {
  $this
    ->drupalLogin($this->rootUser);
  $this
    ->doViewTest();
  $this
    ->doMenuTest();
  $this
    ->doBlockContentTest();
  $this
    ->drupalGet(Url::fromRoute('block.admin_display'));
  $this
    ->clickLink('Place block');

  // Check that the page does not have double escaped HTML tags.
  $this
    ->assertSession()
    ->responseNotContains('<');
}