You are here

public function UrlParameterTest::testNoParameterOnUnroutedLink in Login Destination 8.2

Same name and namespace in other branches
  1. 8 tests/src/Functional/UrlParameterTest.php \Drupal\Tests\login_destination\Functional\UrlParameterTest::testNoParameterOnUnroutedLink()

Ensure no "current" query parameter is added to unrouted link elements.

File

tests/src/Functional/UrlParameterTest.php, line 23

Class

UrlParameterTest
Tests adding current parameter to links.

Namespace

Drupal\Tests\login_destination\Functional

Code

public function testNoParameterOnUnroutedLink() {
  $element = [
    '#title' => $this
      ->randomString(),
    '#type' => 'link',
    '#url' => Url::fromUserInput('/' . $this
      ->randomMachineName()),
  ];
  $rendered_link = $this->container
    ->get('renderer')
    ->renderPlain($element)
    ->__toString();
  $this
    ->assertNotContains('?current=', $rendered_link);
}