You are here

public function UrlParameterTest::testNoParameterOnUnroutedLink in Login Destination 8

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

Test the module does not add the "current" query parameter to unrouted link elements.

File

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

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);
}