You are here

public function UrlHelperTest::providerTestBuildQuery in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php \Drupal\Tests\Component\Utility\UrlHelperTest::providerTestBuildQuery()
  2. 9 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 20

Class

UrlHelperTest
@group Utility

Namespace

Drupal\Tests\Component\Utility

Code

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