? sites/all/modules/cck
? sites/all/modules/devel
? sites/default/settings.php
? sites/default/files/.htaccess
? sites/default/files/simpletest
? sites/default/files/simpletest555420
? sites/default/files/simpletest847386
Index: modules/user/user.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.test,v
retrieving revision 1.46
diff -u -p -r1.46 user.test
--- modules/user/user.test	13 Jul 2009 21:51:42 -0000	1.46
+++ modules/user/user.test	19 Jul 2009 13:34:47 -0000
@@ -838,6 +838,81 @@ class UserAdminTestCase extends DrupalWe
   }
 }
 
+class UserEditTestCase extends DrupalWebTestCase {
+  public static function getInfo() {
+    return array(
+      'name' => 'User edit',
+      'description' => 'Test editing a user (with malicious values and without).',
+      'group' => 'User'
+    );
+  }
+
+  function setUp() {
+    parent::setUp();
+  }
+
+  /**
+   * Edits a user.
+   */
+  function testUserEdit() {
+    $this->user = $this->drupalCreateUser(array());
+    $user = $this->user;
+    $this->drupalLogin($user);
+    
+    // Edit a user correctly.
+    $edit = array(
+      'mail' => $user->mail,
+      'pass[pass1]' => $user->pass_raw,
+      'pass[pass2]' => $user->pass_raw,
+    );
+    $this->DrupalPost('user/' . $user->uid . '/edit', $edit, 'Save');
+    
+    // Check if there where no errors.
+    $this->assertText(t('The changes have been saved.'), t('Successful save message displayed.'));
+    $this->assertNoRaw('<div class="messages error">', t('No error message displayed.'));
+    
+    // Edit a user using a wrong password.
+    $edit = array(
+      'mail' => $user->mail,
+      'pass[pass1]' => $user->pass_raw,
+      'pass[pass2]' => $this->randomName(8),
+    );
+    $this->DrupalPost('user/' . $user->uid . '/edit', $edit, 'Save');
+    
+    // Check if it gives an error because we used a wrong password.
+    $this->assertNoText(t('The changes have been saved.'), t('No successful save message displayed.'));
+    $this->assertRaw(t('The specified passwords do not match.'), t('Error message displayed.'));
+    
+    // Edit a user using a wrong email.
+    $edit = array(
+      'mail' => 'wrong-email.example.com',
+      'pass[pass1]' => $user->pass_raw,
+      'pass[pass2]' => $user->pass_raw,
+    );
+    $this->DrupalPost('user/' . $user->uid . '/edit', $edit, 'Save');
+    
+    // Check if it gives an error because we used a wrong email.
+    $this->assertNoText(t('The changes have been saved.'), t('No successful save message displayed.'));
+    $this->assertRaw(t('The e-mail address %mail is not valid.', array('%mail' => 'wrong-email.example.com')), t('Error message displayed.'));
+    
+    // Edit a user with rights to edit his/her username.
+    $this->user = $this->drupalCreateUser(array('change own username'));
+    $user = $this->user;
+    $this->drupalLogin($user);
+    
+    $edit = array(
+      'name' => $user->name,
+      'mail' => $user->mail,
+      'pass[pass1]' => $user->pass_raw,
+      'pass[pass2]' => $user->pass_raw,
+    );
+    $this->DrupalPost('user/' . $user->uid . '/edit', $edit, 'Save');
+    
+    // Check if there where no errors.
+    $this->assertText(t('The changes have been saved.'), t('Successful save message displayed.'));
+  }
+}
+
 /**
  * Tests for user-configurable time zones.
  */
@@ -1067,4 +1142,4 @@ class UserSaveTestCase extends DrupalWeb
     $user_by_name = user_load_by_name($test_name);
     $this->assertTrue($user_by_name, t('Loading user by name.'));
   }
-}
+}
\ No newline at end of file
