You are here

public function RedirectTest::testNoRedirectAfterRegistering in Login Destination 8.2

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

Tests no redirect after registering in without compatible destination rule.

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

File

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

Class

RedirectTest
Tests redirects.

Namespace

Drupal\Tests\login_destination\Functional

Code

public function testNoRedirectAfterRegistering() {
  $this
    ->config('user.settings')
    ->set('verify_mail', FALSE)
    ->set('register', UserInterface::REGISTER_VISITORS)
    ->save();
  $this
    ->createLoginDestinationToNode1([
    LoginDestination::TRIGGER_LOGIN,
    LoginDestination::TRIGGER_ONE_TIME_LOGIN,
    LoginDestination::TRIGGER_LOGOUT,
  ]);
  $this
    ->register(user_password());
  $this
    ->assertSession()
    ->pageTextContains('Registration successful. You are now logged in.');

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