You are here

public function FormattableMarkupKernelTest::providerTestFormattableMarkupUri 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::providerTestFormattableMarkupUri()
  2. 10 core/tests/Drupal/KernelTests/Component/Render/FormattableMarkupKernelTest.php \Drupal\KernelTests\Component\Render\FormattableMarkupKernelTest::providerTestFormattableMarkupUri()

Return value

array

File

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

Class

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

Namespace

Drupal\KernelTests\Component\Render

Code

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