You are here

public function RedirectTest::testRedirectAfterRegistering 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::testRedirectAfterRegistering()

Tests redirecting after registering without email verification.

File

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

Class

RedirectTest
Tests redirects.

Namespace

Drupal\Tests\login_destination\Functional

Code

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

  // Ensure that the redirect happened.
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->addressEquals('/node/1');
}