You are here

public function XssTest::testViewsUi in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views_ui/src/Tests/XssTest.php \Drupal\views_ui\Tests\XssTest::testViewsUi()

File

core/modules/views_ui/src/Tests/XssTest.php, line 24
Contains \Drupal\views_ui\Tests\XssTest.

Class

XssTest
Tests the Xss vulnerability.

Namespace

Drupal\views_ui\Tests

Code

public function testViewsUi() {
  $this
    ->drupalGet('admin/structure/views');
  $this
    ->assertEscaped('<script>alert("foo");</script>, <marquee>test</marquee>', 'The view tag is properly escaped.');
  $this
    ->drupalGet('admin/structure/views/view/sa_contrib_2013_035');
  $this
    ->assertEscaped('<marquee>test</marquee>', 'Field admin label is properly escaped.');
  $this
    ->drupalGet('admin/structure/views/nojs/handler/sa_contrib_2013_035/page_1/header/area');
  $this
    ->assertEscaped('{{ title }} == <marquee>test</marquee>', 'Token label is properly escaped.');
  $this
    ->assertEscaped('{{ title_1 }} == <script>alert("XSS")</script>', 'Token label is properly escaped.');
}