You are here

public function UrlGeneratorTest::providerTestAliasGenerationWithOptions in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php \Drupal\Tests\Core\Routing\UrlGeneratorTest::providerTestAliasGenerationWithOptions()

Provides test data for testAliasGenerationWithOptions.

File

core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php, line 251
Contains \Drupal\Tests\Core\Routing\UrlGeneratorTest.

Class

UrlGeneratorTest
Confirm that the UrlGenerator is functioning properly.

Namespace

Drupal\Tests\Core\Routing

Code

public function providerTestAliasGenerationWithOptions() {
  $data = [];

  // Extra parameters should appear in the query string.
  $data[] = [
    'test_1',
    [
      'zoo' => '5',
    ],
    [
      'fragment' => 'top',
    ],
    '/hello/world?zoo=5#top',
  ];
  $data[] = [
    'test_2',
    [
      'narf' => '5',
    ],
    [
      'query' => [
        'page' => '1',
      ],
      'fragment' => 'bottom',
    ],
    '/goodbye/cruel/world?page=1#bottom',
  ];

  // Changing the parameters, the route still matches but there is no alias.
  $data[] = [
    'test_2',
    [
      'narf' => '7',
    ],
    [
      'query' => [
        'page' => '1',
      ],
      'fragment' => 'bottom',
    ],
    '/test/two/7?page=1#bottom',
  ];

  // Query string values containing '/' should be decoded.
  $data[] = [
    'test_2',
    [
      'narf' => '7',
    ],
    [
      'query' => [
        'page' => '1/2',
      ],
      'fragment' => 'bottom',
    ],
    '/test/two/7?page=1/2#bottom',
  ];
  return $data;
}