You are here

function SearchPageTextTest::testSearchLabelXSS in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/search/src/Tests/SearchPageTextTest.php \Drupal\search\Tests\SearchPageTextTest::testSearchLabelXSS()

Tests for XSS in search module local task.

This is a regression test for https://www.drupal.org/node/2338081

File

core/modules/search/src/Tests/SearchPageTextTest.php, line 50
Contains \Drupal\search\Tests\SearchPageTextTest.

Class

SearchPageTextTest
Tests the search help text and search page text.

Namespace

Drupal\search\Tests

Code

function testSearchLabelXSS() {
  $this
    ->drupalLogin($this
    ->drupalCreateUser(array(
    'administer search',
  )));
  $keys['label'] = '<script>alert("Dont Panic");</script>';
  $this
    ->drupalPostForm('admin/config/search/pages/manage/node_search', $keys, t('Save search page'));
  $this
    ->drupalLogin($this->searchingUser);
  $this
    ->drupalGet('search/node');
  $this
    ->assertEscaped($keys['label']);
}