You are here

public function XssTest::providerTestFilterXssNormalized in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Component/Utility/XssTest.php \Drupal\Tests\Component\Utility\XssTest::providerTestFilterXssNormalized()

Data provider for testFilterXssNormalized().

Return value

array An array of arrays containing strings:

  • The value to filter.
  • The value to expect after filtering.
  • The assertion message.
  • (optional) The allowed HTML HTML tags array that should be passed to \Drupal\Component\Utility\Xss::filter().

See also

testFilterXssNormalized()

File

core/tests/Drupal/Tests/Component/Utility/XssTest.php, line 88

Class

XssTest
XSS Filtering tests.

Namespace

Drupal\Tests\Component\Utility

Code

public function providerTestFilterXssNormalized() {
  return [
    [
      "Who's Online",
      "who's online",
      'HTML filter -- html entity number',
    ],
    [
      "Who's Online",
      "who's online",
      'HTML filter -- encoded html entity number',
    ],
    [
      "Who' Online",
      "who' online",
      'HTML filter -- double encoded html entity number',
    ],
    // Custom elements with dashes in the tag name.
    [
      "<test-element></test-element>",
      "<test-element></test-element>",
      'Custom element with dashes in tag name.',
      [
        'test-element',
      ],
    ],
  ];
}