function UrlGeneratorTest::providerTestNoPath

Same name and namespace in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php \Drupal\Tests\Core\Routing\UrlGeneratorTest::providerTestNoPath()
  2. 10 core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php \Drupal\Tests\Core\Routing\UrlGeneratorTest::providerTestNoPath()
  3. 11.x core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php \Drupal\Tests\Core\Routing\UrlGeneratorTest::providerTestNoPath()

Data provider for ::testNoPath().

File

core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php, line 490

Class

UrlGeneratorTest
Confirm that the UrlGenerator is functioning properly.

Namespace

Drupal\Tests\Core\Routing

Code

public function providerTestNoPath() {
    return [
        // Empty options.
[
            [],
            '',
        ],
        // Query parameters only.
[
            [
                'query' => [
                    'foo' => 'bar',
                ],
            ],
            '?foo=bar',
        ],
        // Multiple query parameters.
[
            [
                'query' => [
                    'foo' => 'bar',
                    'baz' => '',
                ],
            ],
            '?foo=bar&baz=',
        ],
        // Fragment only.
[
            [
                'fragment' => 'foo',
            ],
            '#foo',
        ],
        // Query parameters and fragment.
[
            [
                'query' => [
                    'bar' => 'baz',
                ],
                'fragment' => 'foo',
            ],
            '?bar=baz#foo',
        ],
        // Multiple query parameters and fragment.
[
            [
                'query' => [
                    'bar' => 'baz',
                    'foo' => 'bar',
                ],
                'fragment' => 'foo',
            ],
            '?bar=baz&foo=bar#foo',
        ],
    ];
}

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