function UrlHelperTest::providerTestFilterQueryParameters

Provides data to self::testFilterQueryParameters().

Return value

array An array of test cases with query parameters, exclusions, and expected results.

File

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

Class

UrlHelperTest
Tests Drupal\Component\Utility\UrlHelper.

Namespace

Drupal\Tests\Component\Utility

Code

public static function providerTestFilterQueryParameters() : array {
  return [
    // Test without an exclude filter.
[
      'query' => [
        'a' => [
          'b' => 'c',
        ],
      ],
      'exclude' => [],
      'expected' => [
        'a' => [
          'b' => 'c',
        ],
      ],
    ],
    // Exclude the 'b' element.
[
      'query' => [
        'a' => [
          'b' => 'c',
          'd' => 'e',
        ],
      ],
      'exclude' => [
        'a[b]',
      ],
      'expected' => [
        'a' => [
          'd' => 'e',
        ],
      ],
    ],
  ];
}

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