diff --git a/core/modules/user/user.test b/core/modules/user/user.test
index 81d3e07..88495b6 100644
--- a/core/modules/user/user.test
+++ b/core/modules/user/user.test
@@ -439,6 +439,86 @@ class UserLoginTestCase extends DrupalWebTestCase {
 }
 
 /**
+ * Test Resetting a user's password.
+ */
+class UserPasswordResetTestCase extends DrupalWebTestCase {
+  public static function getInfo() {
+    return array(
+      'name' => 'Reset Password',
+      'description' => 'Ensure that a user can propperly reset their password.',
+      'group' => 'User',
+    );
+  }
+
+  /**
+   * Attempt to reset a password when an email address matches two accounts.
+   */
+  function testUserPasswordResetDuplicateUsers() {
+    // Don't require email validation for new accounts.
+    variable_set('user_email_verification', FALSE);
+
+    // Don't require admin approval for new accounts.
+    variable_set('user_register', USER_REGISTER_VISITORS);
+
+    // Create a user to be duplicated.
+    $user_with_email = $this->drupalCreateUser();
+
+    // Create a new user with the email from the above as the user's name.
+    $edit = array();
+    $edit['name'] = $user_with_email->mail;
+    $edit['mail'] = $this->randomName() . "@example.com";
+    $edit['pass[pass1]'] = $new_pass = $this->randomName();
+    $edit['pass[pass2]'] = $new_pass;
+    $this->drupalPost('user/register', $edit, t('Create new account'));
+    // To maintain upgradability, registration with an account name that is
+    // used as the email adderess as another account should be allowed.
+    $this->assertText(t('Registration successful. You are now logged in.'), t('Users are logged in after registering.'));
+    // The above logs in the user.  Log out to test password reset.
+    $this->drupalLogout();
+
+    // Get the duplicate user.
+    $users = user_load_multiple(array(), array('name' => $edit['name'], 'status' => '1'));
+    $user_with_name = reset($users);
+
+
+    // Try and reset based on the duplicated email.
+    $edit = array();
+    $edit['name'] = $user_with_email->mail;
+    $this->drupalPost('user/password', $edit, t('E-mail new password'));
+    // There should be a field prompting the user to pick and account.
+    $this->assertField('choose_account', 'User is prompted to pick an account when email matches two accounts.');
+    // We should be sure to not expose another user's email to the user.
+    $this->assertNoText($user_with_name->mail, "Duplicated user's email is not exposed to the other user.");
+
+    // Select the account with the username matching the entered email;
+    $edit = array();
+    $edit['choose_account'] = $user_with_email->uid;
+    $this->drupalPost(NULL, $edit, t('E-mail new password'));
+    $this->assertText(t('Further instructions have been sent to your e-mail address.'), 'User is notified that password reset was sent.');
+
+    // Make sure that right user was sent a reset email.
+    $this->assertEqual(count($this->drupalGetMails(array('key' => 'password_reset', 'to' => $user_with_email->mail))), 1, 'The right user was sent a password reset mail.');
+    // Make sure that the other user was not sent an email.
+    $this->assertEqual(count($this->drupalGetMails(array('key' => 'password_reset', 'to' => $user_with_name->mail))), 0, 'The other user was not sent a password reset mail.');
+
+    // If the user is logged in, they should not have to choose an account to
+    // reset their password.
+    $user_with_name->pass_raw = $new_pass;
+    $this->drupalLogin($user_with_name);
+    $this->drupalGet('user/password');
+    // There should not be a form element for name.
+    $this->assertNoField('name', 'Duplicate user is not asked for a name when resetting password while logged in');
+    $this->drupalPost(NULL, array(), t('E-mail new password'));
+    // Make sure the user was sent an email.
+    $this->assertText(t('Further instructions have been sent to your e-mail address.'), 'User is notified that password reset was sent when logged in.');
+    $this->assertEqual(count($this->drupalGetMails(array('key' => 'password_reset', 'to' => $user_with_name->mail))), 1, 'The right user was sent a password reset mail when logged in.');
+    // Make sure that the other user was not sent an email. (Remembering that
+    // one has already been sent to this user earlier)
+    $this->assertEqual(count($this->drupalGetMails(array('key' => 'password_reset', 'to' => $user_with_email->mail))), 1, 'The other user was not sent a password reset mail when logged in.');
+  }
+}
+
+/**
  * Test cancelling a user.
  */
 class UserCancelTestCase extends DrupalWebTestCase {
