You are here

protected function SimplenewsTestBase::resetPassLogin in Simplenews 8.2

Same name and namespace in other branches
  1. 3.x 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: require login, fields updated.

File

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

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
    ->drupalPostForm("/user/reset/{$uid}/{$timestamp}/{$hash}", [], t('Log in'));
}