Index: modules/user/user.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.admin.inc,v retrieving revision 1.120 diff -u -p -r1.120 user.admin.inc --- modules/user/user.admin.inc 20 Oct 2010 01:31:07 -0000 1.120 +++ modules/user/user.admin.inc 3 Nov 2010 07:48:28 -0000 @@ -878,6 +878,7 @@ function user_admin_roles_order_submit($ $role->weight = $role_values['weight']; user_role_save($role); } + drupal_set_message(t('The role settings have been updated.')); } /** Index: modules/user/user.test =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.test,v retrieving revision 1.104 diff -u -p -r1.104 user.test --- modules/user/user.test 23 Oct 2010 03:20:40 -0000 1.104 +++ modules/user/user.test 3 Nov 2010 07:48:29 -0000 @@ -1416,7 +1416,7 @@ class UserCreateTestCase extends DrupalW public static function getInfo() { return array( 'name' => 'User create', - 'description' => 'Test the creat user administration page.', + 'description' => 'Test the create user administration page.', 'group' => 'User', ); } @@ -1658,7 +1658,7 @@ class UserRoleAdminTestCase extends Drup public static function getInfo() { return array( 'name' => 'User role administration', - 'description' => 'Test adding, editing and deleting user roles.', + 'description' => 'Test adding, editing and deleting user roles and changing role weights.', 'group' => 'User', ); } @@ -1711,6 +1711,28 @@ class UserRoleAdminTestCase extends Drup $this->drupalGet('admin/people/permissions/roles/edit/' . DRUPAL_AUTHENTICATED_RID); $this->assertResponse(403, t('Access denied when trying to edit the built-in authenticated role.')); } + + /** + * Test user role weight change operation. + */ + function testRoleWeightChange() { + $this->drupalLogin($this->admin_user); + + // Pick up a random role and get its weight. + $rid = array_rand(user_roles()); + $role = user_role_load($rid); + $old_weight = $role->weight; + + // Change the role weight and submit the form. + $edit = array('roles['. $rid .'][weight]' => $old_weight + 1); + $this->drupalPost('admin/people/permissions/roles', $edit, t('Save order')); + $this->assertText(t('The role settings have been updated.'), t('The role settings form submitted successfully.')); + + // Retrieve the saved role and compare its weight. + $role = user_role_load($rid); + $new_weight = $role->weight; + $this->assertTrue(($old_weight + 1) == $new_weight, t('Role weight updated successfully.')); + } } /**