function BlockXssTest::testBlockXss

Same name and namespace in other branches
  1. 8.9.x core/modules/block/tests/src/Functional/BlockXssTest.php \Drupal\Tests\block\Functional\BlockXssTest::testBlockXss()
  2. 10 core/modules/block/tests/src/Functional/BlockXssTest.php \Drupal\Tests\block\Functional\BlockXssTest::testBlockXss()
  3. 11.x 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('<');
}

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