public function RedirectTest::testNoRedirectImmediatelyAfterOneTimeLogin in Login Destination 8.2
Same name and namespace in other branches
- 8 tests/src/Functional/RedirectTest.php \Drupal\Tests\login_destination\Functional\RedirectTest::testNoRedirectImmediatelyAfterOneTimeLogin()
Tests no redirect after one-time login without compatible destination rule.
When there are login destination rules and when the setting "Immediate redirect" is enabled, but none of destination rules has a trigger on an one-time login configured, no redirect caused by a login destination rule should happen immediately after one-time login.
File
- tests/
src/ Functional/ RedirectTest.php, line 287
Class
- RedirectTest
- Tests redirects.
Namespace
Drupal\Tests\login_destination\FunctionalCode
public function testNoRedirectImmediatelyAfterOneTimeLogin() {
$this
->config('login_destination.settings')
->set('immediate_redirect', TRUE)
->save();
$this
->createLoginDestinationToNode1([
LoginDestination::TRIGGER_LOGIN,
LoginDestination::TRIGGER_REGISTRATION,
LoginDestination::TRIGGER_LOGOUT,
]);
// Generate password reset URL.
$url = user_pass_reset_url($this->account);
// And use the one-time login link.
$this
->drupalPostForm($url, NULL, 'Log in');
// Ensure that no login destination redirect happened.
$this
->assertSession()
->addressEquals('/user/2/edit');
}