function UrlGeneratorTest::providerTestAliasGenerationWithOptions

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php \Drupal\Tests\Core\Routing\UrlGeneratorTest::providerTestAliasGenerationWithOptions()
  2. 8.9.x core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php \Drupal\Tests\Core\Routing\UrlGeneratorTest::providerTestAliasGenerationWithOptions()
  3. 11.x 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 363

Class

UrlGeneratorTest
Confirm that the UrlGenerator is functioning properly.

Namespace

Drupal\Tests\Core\Routing

Code

public static 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',
        [
            'Lassie' => '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',
        [
            'Lassie' => '7',
        ],
        [
            'query' => [
                'page' => '1',
            ],
            'fragment' => 'bottom',
        ],
        '/test/two/7?page=1#bottom',
    ];
    // Query string values containing '/' should be decoded.
    $data[] = [
        'test_2',
        [
            'Lassie' => '7',
        ],
        [
            'query' => [
                'page' => '1/2',
            ],
            'fragment' => 'bottom',
        ],
        '/test/two/7?page=1/2#bottom',
    ];
    // A NULL query string.
    $data['query-with-NULL'] = [
        'test_2',
        [
            'Lassie' => '7',
        ],
        [
            'query' => NULL,
            'fragment' => 'bottom',
        ],
        '/test/two/7#bottom',
    ];
    return $data;
}

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