You are here

public function UrlTest::expectedCurrentRequestUrlResults in Token 8

Provides a list of results to expect for ::testRequestUrls().

Each data set of this array holds the following order:

  • The request object to test for.
  • The input text as string.
  • The token data as array.
  • Further options for the token replacement as array.
  • The output to expect after token replacement.

Return value

array The list of results to expect.

1 call to UrlTest::expectedCurrentRequestUrlResults()
UrlTest::testCurrentRequestUrls in tests/src/Kernel/UrlTest.php
Test the url token replacements for current requests.

File

tests/src/Kernel/UrlTest.php, line 79

Class

UrlTest
Test generic url token replacements.

Namespace

Drupal\Tests\token\Kernel

Code

public function expectedCurrentRequestUrlResults() {
  return [
    [
      Request::createFromGlobals(),
      '[current-page:url]',
      [],
      [],
      Url::createFromRequest(Request::createFromGlobals())
        ->setAbsolute()
        ->toString(),
    ],
    [
      Request::create('/should-not-exist'),
      '[current-page:url:path]',
      [],
      [],
      '/',
    ],
    [
      Request::create('/https://drupal.org/'),
      '[current-page:url:absolute]',
      [],
      [],
      '[current-page:url:absolute]',
    ],
    [
      Request::create('/https://drupal.org/'),
      '[current-page:url:absolute]',
      [],
      [
        'clear' => TRUE,
      ],
      '',
    ],
  ];
}