function UserPasswordResetTest::assertValidPasswordReset

Same name in other branches
  1. 9 core/modules/user/tests/src/Functional/UserPasswordResetTest.php \Drupal\Tests\user\Functional\UserPasswordResetTest::assertValidPasswordReset()
  2. 8.9.x core/modules/user/tests/src/Functional/UserPasswordResetTest.php \Drupal\Tests\user\Functional\UserPasswordResetTest::assertValidPasswordReset()
  3. 11.x core/modules/user/tests/src/Functional/UserPasswordResetTest.php \Drupal\Tests\user\Functional\UserPasswordResetTest::assertValidPasswordReset()

Helper function to make assertions about a valid password reset.

@internal

4 calls to UserPasswordResetTest::assertValidPasswordReset()
UserPasswordResetTest::testUserPasswordReset in core/modules/user/tests/src/Functional/UserPasswordResetTest.php
Tests password reset functionality.
UserPasswordResetTest::testUserPasswordResetPreferredLanguage in core/modules/user/tests/src/Functional/UserPasswordResetTest.php
Tests password reset functionality when user has set preferred language.
UserPasswordResetTest::testUserResetPasswordUserFloodControl in core/modules/user/tests/src/Functional/UserPasswordResetTest.php
Tests password reset flood control for one user.
UserPasswordResetTest::testUserResetPasswordUserFloodControlIsCleared in core/modules/user/tests/src/Functional/UserPasswordResetTest.php
Tests user password reset flood control is cleared on successful reset.

File

core/modules/user/tests/src/Functional/UserPasswordResetTest.php, line 562

Class

UserPasswordResetTest
Ensure that password reset methods work as expected.

Namespace

Drupal\Tests\user\Functional

Code

public function assertValidPasswordReset(string $name) : void {
    $this->assertSession()
        ->pageTextContains("If {$name} is a valid account, an email will be sent with instructions to reset your password.");
    $this->assertMail('to', $this->account
        ->getEmail(), 'Password email sent to user.');
    $subject = 'Replacement login information for ' . $this->account
        ->getAccountName() . ' at Drupal';
    $this->assertMail('subject', $subject, 'Password reset email subject is correct.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.