function UrlTransformRelativeTest::providerFileUrlTransformRelative

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/File/UrlTransformRelativeTest.php \Drupal\KernelTests\Core\File\UrlTransformRelativeTest::providerFileUrlTransformRelative()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/File/UrlTransformRelativeTest.php \Drupal\KernelTests\Core\File\UrlTransformRelativeTest::providerFileUrlTransformRelative()
  3. 10 core/tests/Drupal/KernelTests/Core/File/UrlTransformRelativeTest.php \Drupal\KernelTests\Core\File\UrlTransformRelativeTest::providerFileUrlTransformRelative()

File

core/tests/Drupal/KernelTests/Core/File/UrlTransformRelativeTest.php, line 51

Class

UrlTransformRelativeTest
Tests URL transform to relative.

Namespace

Drupal\KernelTests\Core\File

Code

public static function providerFileUrlTransformRelative() {
    $data = [
        'http' => [
            'example.com',
            80,
            '',
            '',
            TRUE,
            'http://example.com/page',
            '/page',
        ],
        'http with base path and root relative' => [
            'example.com',
            80,
            '',
            '/~foo',
            TRUE,
            'http://example.com/~foo/page',
            '/~foo/page',
        ],
        'http with base path and not root relative' => [
            'example.com',
            80,
            '',
            '/~foo',
            FALSE,
            'http://example.com/~foo/page',
            '/page',
        ],
        'http with weird base path and root relative' => [
            'example.com',
            80,
            '',
            '/~foo$.*!',
            TRUE,
            'http://example.com/~foo$.*!/page',
            '/~foo$.*!/page',
        ],
        'http with weird base path and not root relative' => [
            'example.com',
            80,
            '',
            '/~foo$.*!',
            FALSE,
            'http://example.com/~foo$.*!/page',
            '/page',
        ],
        'http frontpage' => [
            'example.com',
            80,
            '',
            '',
            TRUE,
            'http://example.com',
            '/',
        ],
        'http frontpage with a slash' => [
            'example.com',
            80,
            '',
            '',
            TRUE,
            'http://example.com/',
            '/',
        ],
        'https on http' => [
            'example.com',
            80,
            '',
            '',
            TRUE,
            'https://example.com/page',
            '/page',
        ],
        'https' => [
            'example.com',
            443,
            'on',
            '',
            TRUE,
            'https://example.com/page',
            '/page',
        ],
        'https frontpage' => [
            'example.com',
            443,
            'on',
            '',
            TRUE,
            'https://example.com',
            '/',
        ],
        'https frontpage with a slash' => [
            'example.com',
            443,
            'on',
            '',
            TRUE,
            'https://example.com/',
            '/',
        ],
        'http with path containing special chars' => [
            'example.com',
            80,
            '',
            '',
            TRUE,
            'http://example.com/~page$.*!',
            '/~page$.*!',
        ],
        'http 8080' => [
            'example.com',
            8080,
            '',
            '',
            TRUE,
            'https://example.com:8080/page',
            '/page',
        ],
        'https 8443' => [
            'example.com',
            8443,
            'on',
            '',
            TRUE,
            'https://example.com:8443/page',
            '/page',
        ],
        'http no dot' => [
            'example.com',
            80,
            '',
            '',
            TRUE,
            'http://exampleXcom/page',
            'http://exampleXcom/page',
        ],
        'http files on different port than the web request' => [
            'example.com',
            80,
            '',
            '',
            TRUE,
            'http://example.com:9000/page',
            'http://example.com:9000/page',
        ],
        'https files on different port than the web request' => [
            'example.com',
            443,
            'on',
            '',
            TRUE,
            'https://example.com:8443/page',
            'https://example.com:8443/page',
        ],
        'http files on different port than the web request on non default port' => [
            'example.com',
            8080,
            '',
            '',
            TRUE,
            'http://example.com:9000/page',
            'http://example.com:9000/page',
        ],
        'https files on different port than the web request on non default port' => [
            'example.com',
            8443,
            'on',
            '',
            TRUE,
            'https://example.com:9000/page',
            'https://example.com:9000/page',
        ],
        'http with default port explicit mentioned in URL' => [
            'example.com',
            80,
            '',
            '',
            TRUE,
            'http://example.com:80/page',
            '/page',
        ],
        'https with default port explicit mentioned in URL' => [
            'example.com',
            443,
            'on',
            '',
            TRUE,
            'https://example.com:443/page',
            '/page',
        ],
    ];
    return $data;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.