You are here

public function XssTest::providerTestFilterXssNormalized in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 93
Contains \Drupal\Tests\Component\Utility\XssTest.

Class

XssTest
XSS Filtering tests.

Namespace

Drupal\Tests\Component\Utility

Code

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