function FieldLinkTest::canonicalizeUriDataProvider
Data provider for testCanonicalizeUri.
File
- 
              core/
modules/ link/ tests/ src/ Unit/ Plugin/ migrate/ process/ FieldLinkTest.php, line 38  
Class
- FieldLinkTest
 - Tests the link field migrate process plugin.
 
Namespace
Drupal\Tests\link\Unit\Plugin\migrate\processCode
public static 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 without explicit protocol (protocol-relative)' => [
      '//example.com',
      'http://example.com',
    ],
    '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>',
    ],
  ];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.