function UrlHelperTest::providerTestBuildQuery

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php \Drupal\Tests\Component\Utility\UrlHelperTest::providerTestBuildQuery()
  2. 8.9.x core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php \Drupal\Tests\Component\Utility\UrlHelperTest::providerTestBuildQuery()
  3. 11.x core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php \Drupal\Tests\Component\Utility\UrlHelperTest::providerTestBuildQuery()

Provides test data for testBuildQuery().

Return value

array

File

core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php, line 22

Class

UrlHelperTest
@group Utility

Namespace

Drupal\Tests\Component\Utility

Code

public static function providerTestBuildQuery() {
    return [
        [
            [
                'a' => ' &#//+%20@۞',
            ],
            'a=%20%26%23//%2B%2520%40%DB%9E',
            'Value was properly encoded.',
        ],
        [
            [
                ' &#//+%20@۞' => 'a',
            ],
            '%20%26%23%2F%2F%2B%2520%40%DB%9E=a',
            'Key was properly encoded.',
        ],
        [
            [
                'a' => '1',
                'b' => '2',
                'c' => '3',
            ],
            'a=1&b=2&c=3',
            'Multiple values were properly concatenated.',
        ],
        [
            [
                'a' => [
                    'b' => '2',
                    'c' => '3',
                ],
                'd' => 'foo',
            ],
            'a%5Bb%5D=2&a%5Bc%5D=3&d=foo',
            'Nested array was properly encoded.',
        ],
        [
            [
                'foo' => NULL,
            ],
            'foo',
            'Simple parameters are properly added.',
        ],
    ];
}

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