function UnroutedUrlAssemblerTest::providerTestAssembleWithExternalUrl

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php \Drupal\Tests\Core\Utility\UnroutedUrlAssemblerTest::providerTestAssembleWithExternalUrl()
  2. 10 core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php \Drupal\Tests\Core\Utility\UnroutedUrlAssemblerTest::providerTestAssembleWithExternalUrl()
  3. 11.x core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php \Drupal\Tests\Core\Utility\UnroutedUrlAssemblerTest::providerTestAssembleWithExternalUrl()

Provides test data for testAssembleWithExternalUrl

File

core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php, line 90

Class

UnroutedUrlAssemblerTest
@coversDefaultClass \Drupal\Core\Utility\UnroutedUrlAssembler @group Utility

Namespace

Drupal\Tests\Core\Utility

Code

public function providerTestAssembleWithExternalUrl() {
    return [
        [
            'http://example.com/test',
            [],
            'http://example.com/test',
        ],
        [
            'http://example.com/test',
            [
                'fragment' => 'example',
            ],
            'http://example.com/test#example',
        ],
        [
            'http://example.com/test',
            [
                'fragment' => 'example',
            ],
            'http://example.com/test#example',
        ],
        [
            'http://example.com/test',
            [
                'query' => [
                    'foo' => 'bar',
                ],
            ],
            'http://example.com/test?foo=bar',
        ],
        [
            'http://example.com/test',
            [
                'https' => TRUE,
            ],
            'https://example.com/test',
        ],
        [
            'https://example.com/test',
            [
                'https' => FALSE,
            ],
            'http://example.com/test',
        ],
        [
            'https://example.com/test?foo=1#bar',
            [],
            'https://example.com/test?foo=1#bar',
        ],
        'override-query' => [
            'https://example.com/test?foo=1#bar',
            [
                'query' => [
                    'foo' => 2,
                ],
            ],
            'https://example.com/test?foo=2#bar',
        ],
        'override-query-merge' => [
            'https://example.com/test?foo=1#bar',
            [
                'query' => [
                    'bar' => 2,
                ],
            ],
            'https://example.com/test?foo=1&bar=2#bar',
        ],
        'override-deep-query-merge' => [
            'https://example.com/test?foo=1#bar',
            [
                'query' => [
                    'bar' => [
                        'baz' => 'foo',
                    ],
                ],
            ],
            'https://example.com/test?foo=1&bar%5Bbaz%5D=foo#bar',
        ],
        'override-deep-query-merge-int-ket' => [
            'https://example.com/test?120=1',
            [
                'query' => [
                    'bar' => [
                        'baz' => 'foo',
                    ],
                ],
            ],
            'https://example.com/test?120=1&bar%5Bbaz%5D=foo',
        ],
        'override-fragment' => [
            'https://example.com/test?foo=1#bar',
            [
                'fragment' => 'baz',
            ],
            'https://example.com/test?foo=1#baz',
        ],
        [
            '//www.drupal.org',
            [],
            '//www.drupal.org',
        ],
    ];
}

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