You are here

public function UrlGeneratorTest::providerTestNoPath in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php \Drupal\Tests\Core\Routing\UrlGeneratorTest::providerTestNoPath()
  2. 9 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 492

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',
    ],
  ];
}