function XssTest::providerTestAttributes

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Component/Utility/XssTest.php \Drupal\Tests\Component\Utility\XssTest::providerTestAttributes()
  2. 10 core/tests/Drupal/Tests/Component/Utility/XssTest.php \Drupal\Tests\Component\Utility\XssTest::providerTestAttributes()
  3. 11.x core/tests/Drupal/Tests/Component/Utility/XssTest.php \Drupal\Tests\Component\Utility\XssTest::providerTestAttributes()

Data provider for testFilterXssAdminNotNormalized().

File

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

Class

XssTest
XSS Filtering tests.

Namespace

Drupal\Tests\Component\Utility

Code

public function providerTestAttributes() {
    return [
        [
            '<img src="http://example.com/foo.jpg" title="Example: title" alt="Example: alt">',
            '<img src="http://example.com/foo.jpg" title="Example: title" alt="Example: alt">',
            'Image tag with alt and title attribute',
            [
                'img',
            ],
        ],
        [
            '<a href="https://www.drupal.org/" rel="dc:publisher">Drupal</a>',
            '<a href="https://www.drupal.org/" rel="dc:publisher">Drupal</a>',
            'Link tag with rel attribute',
            [
                'a',
            ],
        ],
        [
            '<span property="dc:subject">Drupal 8: The best release ever.</span>',
            '<span property="dc:subject">Drupal 8: The best release ever.</span>',
            'Span tag with property attribute',
            [
                'span',
            ],
        ],
        [
            '<img src="http://example.com/foo.jpg" data-caption="Drupal 8: The best release ever.">',
            '<img src="http://example.com/foo.jpg" data-caption="Drupal 8: The best release ever.">',
            'Image tag with data attribute',
            [
                'img',
            ],
        ],
        [
            '<a data-a2a-url="foo"></a>',
            '<a data-a2a-url="foo"></a>',
            'Link tag with numeric data attribute',
            [
                'a',
            ],
        ],
    ];
}

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