function FormattableMarkupKernelTest::providerTestFormattableMarkupUriWithException

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Component/Render/FormattableMarkupKernelTest.php \Drupal\KernelTests\Component\Render\FormattableMarkupKernelTest::providerTestFormattableMarkupUriWithException()
  2. 10 core/tests/Drupal/KernelTests/Component/Render/FormattableMarkupKernelTest.php \Drupal\KernelTests\Component\Render\FormattableMarkupKernelTest::providerTestFormattableMarkupUriWithException()
  3. 11.x 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 124

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;
}

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