You are here

UrlParameterTest.php in Login Destination 8.2

Same filename and directory in other branches
  1. 8 tests/src/Functional/UrlParameterTest.php

File

tests/src/Functional/UrlParameterTest.php
View source
<?php

namespace Drupal\Tests\login_destination\Functional;

use Drupal\Tests\BrowserTestBase;
use Drupal\Core\Url;

/**
 * Tests adding current parameter to links.
 *
 * @group login_destination
 */
class UrlParameterTest extends BrowserTestBase {

  /**
   * {@inheritdoc}
   */
  public static $modules = [
    'login_destination',
  ];

  /**
   * Ensure no "current" query parameter is added to unrouted link elements.
   */
  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);
  }

}

Classes

Namesort descending Description
UrlParameterTest Tests adding current parameter to links.