function XssTest::providerTestFilterXssNormalized

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Component/Utility/XssTest.php \Drupal\Tests\Component\Utility\XssTest::providerTestFilterXssNormalized()
  2. 8.9.x core/tests/Drupal/Tests/Component/Utility/XssTest.php \Drupal\Tests\Component\Utility\XssTest::providerTestFilterXssNormalized()
  3. 11.x 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 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 96

Class

XssTest
XSS Filtering tests.

Namespace

Drupal\Tests\Component\Utility

Code

public static 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',
            ],
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.