You are here

public function UrlBagTest::dataProviderToLocal in Mini site 8

Data provider for testToLocal.

File

tests/src/Kernel/UrlBagTest.php, line 41

Class

UrlBagTest
Class UrlBagTest.

Namespace

Drupal\Tests\minisite\Kernel

Code

public function dataProviderToLocal() {
  return [
    [
      'http://example.com',
      'http://example.com/page1',
      '/page1',
    ],
    [
      'http://example.com',
      'http://example.com/sub/path/page1',
      '/sub/path/page1',
    ],
    [
      'http://example.com',
      '/page1',
      '/page1',
    ],
    [
      'http://example.com',
      '/sub/path/page1',
      '/sub/path/page1',
    ],
    [
      'http://example.com',
      'page1',
      '/page1',
    ],
    [
      'http://example.com',
      'subpath/page1',
      '/subpath/page1',
    ],
    [
      'http://example.com',
      'http://otherexample.com/page1',
      '',
      TRUE,
    ],
    [
      'http://example.com',
      'http://otherexample.com',
      '',
      TRUE,
    ],
    [
      'http://example.com',
      'http://example.com',
      '',
      TRUE,
    ],
    // File.
    [
      'http://example.com',
      'public://page1',
      'public://page1',
    ],
    [
      'http://example.com/hostpath',
      'public://page1',
      'public://page1',
    ],
    // Base URL is a subdir.
    [
      'http://example.com/subdir',
      '/page1',
      '/page1',
    ],
    [
      'http://example.com/subdir',
      'page1',
      '/page1',
    ],
    [
      'http://example.com/subdir',
      '/pagesub/page1',
      '/pagesub/page1',
    ],
    [
      'http://example.com/subdir',
      'http://example.com/subdir/pagesub/page1',
      '/pagesub/page1',
    ],
  ];
}