public function UsernameEnumerationPreventionTestCase::testPasswordResetBlocked in Username Enumeration Prevention 7
Ensure the password reset form does not actually work for blocked users.
File
- tests/
simpletest/ username_enumeration_prevention.test, line 82 - Test case for enumerating password reset form.
Class
- UsernameEnumerationPreventionTestCase
- The UsernameEnumerationPreventionTestCase tests functionality of this module.
Code
public function testPasswordResetBlocked() {
// Create a user and block it.
$user = $this
->drupalCreateUser();
$user->status = 0;
user_save($user);
// Submit the password reset form.
$edit = [
'name' => $user->name,
];
$this
->drupalPost('user/password', $edit, t('E-mail new password'));
// Ensure email did not get sent.
$mail = $this
->getResetMail();
$this
->assertTrue(empty($mail), 'Blocked user did not get password reset email.');
}