You are here

public function FormattableMarkupKernelTest::providerTestFormattableMarkupUriWithException in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Component/Render/FormattableMarkupKernelTest.php \Drupal\KernelTests\Component\Render\FormattableMarkupKernelTest::providerTestFormattableMarkupUriWithException()

Return value

array

File

core/tests/Drupal/KernelTests/Component/Render/FormattableMarkupKernelTest.php, line 115

Class

FormattableMarkupKernelTest
Provides a test covering integration of FormattableMarkup with other systems.

Namespace

Drupal\KernelTests\Component\Render

Code

public function providerTestFormattableMarkupUriWithException() {
  $data = [];
  $data['js-protocol'] = [
    'Hey giraffe <a href=":url">MUUUH</a>',
    "javascript:alert('xss')",
  ];
  $data['js-with-fromCharCode'] = [
    'Hey giraffe <a href=":url">MUUUH</a>',
    "javascript:alert(String.fromCharCode(88,83,83))",
  ];
  $data['non-url-with-colon'] = [
    'Hey giraffe <a href=":url">MUUUH</a>',
    "llamas: they are not URLs",
  ];
  $data['non-url-with-html'] = [
    'Hey giraffe <a href=":url">MUUUH</a>',
    '<span>not a url</span>',
  ];
  return $data;
}