public function UserPasswordResetTest::assertValidPasswordReset in Drupal 9
Same name and namespace in other branches
- 8 core/modules/user/tests/src/Functional/UserPasswordResetTest.php \Drupal\Tests\user\Functional\UserPasswordResetTest::assertValidPasswordReset()
Helper function to make assertions about a valid password reset.
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 490
Class
- UserPasswordResetTest
- Ensure that password reset methods work as expected.
Namespace
Drupal\Tests\user\FunctionalCode
public function assertValidPasswordReset($name) {
$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 e-mail sent to user.');
$subject = t('Replacement login information for @username at @site', [
'@username' => $this->account
->getAccountName(),
'@site' => \Drupal::config('system.site')
->get('name'),
]);
$this
->assertMail('subject', $subject, 'Password reset e-mail subject is correct.');
}