You are here

public function RedirectTest::testNoRedirectAfterLogout in Login Destination 8

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

Tests no redirect after logging out without compatible destination rule.

When there are login destination rules, but none of them has a trigger on logout configured, no redirect caused by a login destination rule should happen on logout.

File

tests/src/Functional/RedirectTest.php, line 351

Class

RedirectTest
Tests redirects.

Namespace

Drupal\Tests\login_destination\Functional

Code

public function testNoRedirectAfterLogout() {
  $this
    ->createLoginDestinationToNode1([
    LoginDestination::TRIGGER_LOGIN,
    LoginDestination::TRIGGER_REGISTRATION,
    LoginDestination::TRIGGER_ONE_TIME_LOGIN,
  ]);
  $this
    ->drupalLogin($this->account);
  $this
    ->drupalGet('/user/2');
  $this
    ->drupalLogout();

  // Ensure that no login destination redirect happened.
  $this
    ->assertSession()
    ->addressEquals('/');
}