function LinkFieldTest::getUrlWithComplexQuery

Same name in other branches
  1. 10 core/modules/link/tests/src/Functional/LinkFieldTest.php \Drupal\Tests\link\Functional\LinkFieldTest::getUrlWithComplexQuery()

Get array of url with complex query parameters for render check.

Return value

array The URLs to test.

2 calls to LinkFieldTest::getUrlWithComplexQuery()
LinkFieldTest::getUrlWithComplexQueryInputList in core/modules/link/tests/src/Functional/LinkFieldTest.php
Get list of url with complex query parameters for input check.
LinkFieldTest::testLinkFormatterQueryParametersDuplication in core/modules/link/tests/src/Functional/LinkFieldTest.php
Tests the default 'link' formatter with complex query parameters.

File

core/modules/link/tests/src/Functional/LinkFieldTest.php, line 678

Class

LinkFieldTest
Tests link field widgets and formatters.

Namespace

Drupal\Tests\link\Functional

Code

protected function getUrlWithComplexQuery() : array {
    $test_urls = [
        [
            'inputByUser' => '?a[]=1&a[]=2',
            'renderedHref' => '?a%5B0%5D=1&a%5B1%5D=2',
        ],
        [
            'inputByUser' => '?b[0]=1&b[1]=2',
            'renderedHref' => '?b%5B0%5D=1&b%5B1%5D=2',
        ],
        // UrlHelper::buildQuery will change order of params.
[
            'inputByUser' => '?c[]=1&d=3&c[]=2',
            'renderedHref' => '?c%5B0%5D=1&c%5B1%5D=2&d=3',
        ],
        [
            'inputByUser' => '?e[f][g]=h',
            'renderedHref' => '?e%5Bf%5D%5Bg%5D=h',
        ],
        [
            'inputByUser' => '?i[j[k]]=l',
            'renderedHref' => '?i%5Bj%5Bk%5D=l',
        ],
        // Query string replace value.
[
            'inputByUser' => '?x=1&x=2',
            'renderedHref' => '?x=2',
        ],
        [
            'inputByUser' => '?z[0]=1&z[0]=2',
            'renderedHref' => '?z%5B0%5D=2',
        ],
    ];
    return $test_urls;
}

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