public function BlockXssTest::testXssInCategory in Drupal 8
Same name and namespace in other branches
- 9 core/modules/block/tests/src/Functional/BlockXssTest.php \Drupal\Tests\block\Functional\BlockXssTest::testXssInCategory()
Tests XSS in category.
File
- core/
modules/ block/ tests/ src/ Functional/ BlockXssTest.php, line 67
Class
- BlockXssTest
- Tests that the block module properly escapes block descriptions.
Namespace
Drupal\Tests\block\FunctionalCode
public function testXssInCategory() {
$this->container
->get('module_installer')
->install([
'block_test',
]);
$this
->drupalPlaceBlock('test_xss_title');
$this
->drupalLogin($this
->drupalCreateUser([
'administer blocks',
'access administration pages',
]));
$this
->drupalGet(Url::fromRoute('block.admin_display'));
$this
->clickLink('Place block');
$this
->assertNoRaw("<script>alert('XSS category');</script>");
}