You are here

public function FieldLinkTest::canonicalizeUriDataProvider in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/link/tests/src/Unit/Plugin/migrate/process/FieldLinkTest.php \Drupal\Tests\link\Unit\Plugin\migrate\process\FieldLinkTest::canonicalizeUriDataProvider()

Data provider for testCanonicalizeUri.

File

core/modules/link/tests/src/Unit/Plugin/migrate/process/FieldLinkTest.php, line 34

Class

FieldLinkTest
@group Link

Namespace

Drupal\Tests\link\Unit\Plugin\migrate\process

Code

public function canonicalizeUriDataProvider() {
  return [
    'Simple front-page' => [
      '<front>',
      'internal:/',
    ],
    'Front page with query' => [
      '<front>?query=1',
      'internal:/?query=1',
    ],
    'No leading forward slash' => [
      'node/10',
      'internal:/node/10',
    ],
    'Leading forward slash' => [
      '/node/10',
      'internal:/node/10',
    ],
    'Existing scheme' => [
      'scheme:test',
      'scheme:test',
    ],
    'Absolute URL with protocol prefix' => [
      'http://www.google.com',
      'http://www.google.com',
    ],
    'Absolute URL without protocol prefix' => [
      'www.yahoo.com',
      'http://www.yahoo.com',
    ],
    'Absolute URL without protocol prefix nor www' => [
      'yahoo.com',
      'https://yahoo.com',
      [
        'uri_scheme' => 'https://',
      ],
    ],
    'Absolute URL with non-standard characters' => [
      'http://www.ßÀÑÐ¥ƒå¢ë.com',
      'http://www.ßÀÑÐ¥ƒå¢ë.com',
    ],
    'Absolute URL with non-standard characters, without protocol prefix' => [
      'www.ÐØÑ¢åþë.com',
      'http://www.ÐØÑ¢åþë.com',
    ],
    'Absolute URL with non-standard top level domain' => [
      'http://www.example.xxx',
      'http://www.example.xxx',
    ],
    'Internal link with fragment' => [
      '/node/10#top',
      'internal:/node/10#top',
    ],
    'External link with fragment' => [
      'http://www.example.com/page#links',
      'http://www.example.com/page#links',
    ],
    'empty' => [
      '',
      'route:<nolink>',
    ],
    'No link' => [
      '<nolink>',
      'route:<nolink>',
    ],
    'none' => [
      '<none>',
      'route:<nolink>',
    ],
  ];
}