You are here

public function SafeMarkupKernelTest::providerTestSafeMarkupUri 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::providerTestSafeMarkupUri()

Return value

array

File

core/tests/Drupal/KernelTests/Component/Utility/SafeMarkupKernelTest.php, line 67
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 providerTestSafeMarkupUri() {
  $data = [];
  $data['routed-url'] = [
    'Hey giraffe <a href=":url">MUUUH</a>',
    'route:system.admin',
    [],
    'Hey giraffe <a href="/admin">MUUUH</a>',
  ];
  $data['routed-with-query'] = [
    'Hey giraffe <a href=":url">MUUUH</a>',
    'route:system.admin',
    [
      'query' => [
        'bar' => 'baz#',
      ],
    ],
    'Hey giraffe <a href="/admin?bar=baz%23">MUUUH</a>',
  ];
  $data['routed-with-fragment'] = [
    'Hey giraffe <a href=":url">MUUUH</a>',
    'route:system.admin',
    [
      'fragment' => 'bar&lt;',
    ],
    'Hey giraffe <a href="/admin#bar&amp;lt;">MUUUH</a>',
  ];
  $data['unrouted-url'] = [
    'Hey giraffe <a href=":url">MUUUH</a>',
    'base://foo',
    [],
    'Hey giraffe <a href="/foo">MUUUH</a>',
  ];
  $data['unrouted-with-query'] = [
    'Hey giraffe <a href=":url">MUUUH</a>',
    'base://foo',
    [
      'query' => [
        'bar' => 'baz#',
      ],
    ],
    'Hey giraffe <a href="/foo?bar=baz%23">MUUUH</a>',
  ];
  $data['unrouted-with-fragment'] = [
    'Hey giraffe <a href=":url">MUUUH</a>',
    'base://foo',
    [
      'fragment' => 'bar&lt;',
    ],
    'Hey giraffe <a href="/foo#bar&amp;lt;">MUUUH</a>',
  ];
  $data['mailto-protocol'] = [
    'Hey giraffe <a href=":url">MUUUH</a>',
    'mailto:test@example.com',
    [],
    'Hey giraffe <a href="mailto:test@example.com">MUUUH</a>',
  ];
  return $data;
}