You are here

public function XssTest::providerTestAttributes 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::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',
      ],
    ],
  ];
}