Index: modules/user/user.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.admin.inc,v retrieving revision 1.108 diff -u -p -r1.108 user.admin.inc --- modules/user/user.admin.inc 24 Apr 2010 14:49:14 -0000 1.108 +++ modules/user/user.admin.inc 2 May 2010 17:14:01 -0000 @@ -863,6 +863,7 @@ function user_admin_roles_order_submit($ $role->weight = $role_values['weight']; user_role_save($role); } + drupal_set_message(t('The role setting has been updated.')); } /** Index: modules/user/user.test =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.test,v retrieving revision 1.90 diff -u -p -r1.90 user.test --- modules/user/user.test 1 May 2010 08:12:23 -0000 1.90 +++ modules/user/user.test 2 May 2010 17:14:01 -0000 @@ -1466,7 +1466,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 role weight change operation.', 'group' => 'User', ); } @@ -1519,6 +1519,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 rand 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 setting has been updated.'), t('The role settings form submitted successfully.')); + + // Retrive 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.')); + } } /**