You are here

protected function SimplenewsTestBase::resetPassLogin in Simplenews 3.x

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/SimplenewsTestBase.php \Drupal\Tests\simplenews\Functional\SimplenewsTestBase::resetPassLogin()

Login a user, resetting their password.

Can be used if user is unverified and does not yet have a password.

Parameters

\Drupal\user\UserInterface $user: The user to login.

2 calls to SimplenewsTestBase::resetPassLogin()
SimplenewsPersonalizationFormsTest::testDisableAccount in tests/src/Functional/SimplenewsPersonalizationFormsTest.php
Disable account, subscriptions inactive.
SimplenewsPersonalizationFormsTest::testSynchronizeRegisterSubscribe in tests/src/Functional/SimplenewsPersonalizationFormsTest.php
Register then subscribe: fields updated.

File

tests/src/Functional/SimplenewsTestBase.php, line 255

Class

SimplenewsTestBase
Base class for simplenews web tests.

Namespace

Drupal\Tests\simplenews\Functional

Code

protected function resetPassLogin(UserInterface $user) {
  $uid = $user
    ->id();
  $timestamp = REQUEST_TIME;
  $hash = user_pass_rehash($user, $timestamp);
  $this
    ->drupalGet("/user/reset/{$uid}/{$timestamp}/{$hash}");
  $this
    ->submitForm([], 'Log in');
}