function UserPasswordResetTest::assertNoValidPasswordReset
Same name in other branches
- 8.9.x core/modules/user/tests/src/Functional/UserPasswordResetTest.php \Drupal\Tests\user\Functional\UserPasswordResetTest::assertNoValidPasswordReset()
- 10 core/modules/user/tests/src/Functional/UserPasswordResetTest.php \Drupal\Tests\user\Functional\UserPasswordResetTest::assertNoValidPasswordReset()
- 11.x core/modules/user/tests/src/Functional/UserPasswordResetTest.php \Drupal\Tests\user\Functional\UserPasswordResetTest::assertNoValidPasswordReset()
Helper function to make assertions about an invalid password reset.
@internal
Parameters
string $name: The user name.
2 calls to UserPasswordResetTest::assertNoValidPasswordReset()
- UserPasswordResetTest::testUserPasswordReset in core/
modules/ user/ tests/ src/ Functional/ UserPasswordResetTest.php - Tests password reset functionality.
- UserPasswordResetTest::testUserResetPasswordIpFloodControl in core/
modules/ user/ tests/ src/ Functional/ UserPasswordResetTest.php - Tests password reset flood control for one IP.
File
-
core/
modules/ user/ tests/ src/ Functional/ UserPasswordResetTest.php, line 512
Class
- UserPasswordResetTest
- Ensure that password reset methods work as expected.
Namespace
Drupal\Tests\user\FunctionalCode
public function assertNoValidPasswordReset(string $name) : void {
// This message is the same as the valid reset for privacy reasons.
$this->assertSession()
->pageTextContains("If {$name} is a valid account, an email will be sent with instructions to reset your password.");
// The difference is that no email is sent.
$this->assertCount(0, $this->drupalGetMails([
'id' => 'user_password_reset',
]), 'No e-mail was sent when requesting a password for an invalid account.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.