You are here

public function PasswordResetTest::setUp in Legal 8

Same name and namespace in other branches
  1. 2.0.x tests/src/Functional/PasswordResetTest.php \Drupal\Tests\legal\Functional\PasswordResetTest::setUp()

Overrides LegalTestBase::setUp

File

tests/src/Functional/PasswordResetTest.php, line 23

Class

PasswordResetTest
Tests password reset workflow when T&Cs need to be accepted.

Namespace

Drupal\Tests\legal\Functional

Code

public function setUp() {
  parent::setUp();

  // Set the last login time that is used to generate the one-time link so
  // that it is definitely over a second ago.
  $this->account->login = \Drupal::time()
    ->getRequestTime() - mt_rand(10, 100000);
  \Drupal::database()
    ->update('users_field_data')
    ->fields([
    'login' => $this->account
      ->getLastLoginTime(),
  ])
    ->condition('uid', $this->account
    ->id())
    ->execute();
}