You are here

public function XssTest::providerTestAttributes in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Component/Utility/XssTest.php \Drupal\Tests\Component\Utility\XssTest::providerTestAttributes()
  2. 9 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 504

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" class="md:block">',
      '<img src="http://example.com/foo.jpg" title="Example: title" alt="Example: alt" class="md:block">',
      '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',
      ],
    ],
  ];
}