summaryrefslogtreecommitdiff
path: root/modules/user/user.test
diff options
context:
space:
mode:
Diffstat (limited to 'modules/user/user.test')
-rw-r--r--modules/user/user.test36
1 files changed, 36 insertions, 0 deletions
diff --git a/modules/user/user.test b/modules/user/user.test
index 70925ad8c..cc1e0cb96 100644
--- a/modules/user/user.test
+++ b/modules/user/user.test
@@ -1421,3 +1421,39 @@ class UserEditTestCase extends DrupalWebTestCase {
$this->drupalLogout();
}
}
+
+/**
+ * Test that a user, having editing their own account, can still log in.
+ */
+class UserEditedOwnAccountTestCase extends DrupalWebTestCase {
+
+ public static function getInfo() {
+ return array(
+ 'name' => 'User edited own account',
+ 'description' => 'Test user edited own account can still log in.',
+ 'group' => 'User',
+ );
+ }
+
+ function testUserEditedOwnAccount() {
+ // Change account setting 'Who can register accounts?' to Administrators
+ // only.
+ variable_set('user_register', 0);
+
+ // Create a new user account and log in.
+ $account = $this->drupalCreateUser(array('change own username'));
+ $this->drupalLogin($account);
+
+ // Change own username.
+ $edit = array();
+ $edit['name'] = $this->randomName();
+ $this->drupalPost('user/' . $account->uid . '/edit', $edit, t('Save'));
+
+ // Log out.
+ $this->drupalLogout();
+
+ // Set the new name on the user account and attempt to log back in.
+ $account->name = $edit['name'];
+ $this->drupalLogin($account);
+ }
+} \ No newline at end of file