You are here

public function UsernameEnumerationPreventionTestCase::testPasswordResetActive in Username Enumeration Prevention 7

Ensure the password reset form sends an email for valid users.

File

tests/simpletest/username_enumeration_prevention.test, line 66
Test case for enumerating password reset form.

Class

UsernameEnumerationPreventionTestCase
The UsernameEnumerationPreventionTestCase tests functionality of this module.

Code

public function testPasswordResetActive() {

  // Create a user.
  $user = $this
    ->drupalCreateUser();

  // 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
    ->assertFalse(empty($mail), 'Active user received password reset email.');
}