You are here

public function SafeMarkupKernelTest::providerTestSafeMarkupUriWithException in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/KernelTests/Component/Utility/SafeMarkupKernelTest.php \Drupal\KernelTests\Component\Utility\SafeMarkupKernelTest::providerTestSafeMarkupUriWithException()

Return value

array

File

core/tests/Drupal/KernelTests/Component/Utility/SafeMarkupKernelTest.php, line 129
Contains \Drupal\KernelTests\Component\Utility\SafeMarkupKernelTest.

Class

SafeMarkupKernelTest
Provides a test covering integration of SafeMarkup with other systems.

Namespace

Drupal\KernelTests\Component\Utility

Code

public function providerTestSafeMarkupUriWithException() {
  $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;
}