From 551cc7489698c0219d1902b78cc47d0dbdb2a77e Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 4 Jun 2009 09:52:33 +0000 Subject: - Patch #480660 by catch, brianV, et al: add an administrator role to core. --- modules/user/user.test | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'modules/user/user.test') diff --git a/modules/user/user.test b/modules/user/user.test index 9b5e6d471..e12294a3a 100644 --- a/modules/user/user.test +++ b/modules/user/user.test @@ -733,7 +733,7 @@ class UserPermissionsTestCase extends DrupalWebTestCase { function setUp() { parent::setUp(); - $this->admin_user = $this->drupalCreateUser(array('administer permissions', 'access user profiles')); + $this->admin_user = $this->drupalCreateUser(array('administer permissions', 'access user profiles', 'administer site configuration', 'administer users')); // Find the new role ID - it must be the maximum. $all_rids = array_keys($this->admin_user->roles); @@ -766,6 +766,26 @@ class UserPermissionsTestCase extends DrupalWebTestCase { $this->assertFalse(user_access('access user profiles', $account, TRUE), t('User no longer has "access user profiles" permission.')); } + /** + * Test assigning of permissions for the administrator role. + */ + function testAdministratorRole() { + $this->drupalLogin($this->admin_user); + $this->drupalGet('admin/user/settings'); + + // Set the user's role to be the administrator role. + $edit = array(); + $edit['user_admin_role'] = $this->rid; + $this->drupalPost('admin/user/settings', $edit, t('Save configuration')); + + // Enable aggregator module and ensure the 'administer news feeds' + // permission is assigned by default. + $edit = array(); + $edit['modules[Core][aggregator][enable]'] = TRUE; + $this->drupalPost('admin/build/modules', $edit, t('Save configuration')); + + $this->assertTrue(user_access('administer news feeds', $this->admin_user, TRUE), t('The permission was automatically assigned to the administrator role')); + } } class UserAdminTestCase extends DrupalWebTestCase { -- cgit v1.2.3