public function RoleDelegationPermissionsTestCase::testRoleDelegationPageAccess in Role Delegation 7
Check access to the role delegation page.
File
- ./
role_delegation.test, line 171 - Tests for the Role Delegation module.
Class
- RoleDelegationPermissionsTestCase
- Functional tests for permissions.
Code
public function testRoleDelegationPageAccess() {
// Users with 'administer permissions' can view the page.
$this
->drupalGet("user/{$this->user_low->uid}/roles");
$this
->assertResponse(200, t('Users with \'administer permissions\' can view the page.'));
// Anonymous users can never access the roles page.
$this
->drupalLogout();
$this
->drupalGet("user/{$this->user_low->uid}/roles");
$this
->assertResponse(403, t('Anonymous users can never access the roles page.'));
// Users with only 'administer users' cannot view the page.
$this
->drupalLogin($this
->drupalCreateUser(array(
'administer users',
)));
$this
->drupalGet("user/{$this->user_low->uid}/roles");
$this
->assertResponse(403, t('Users with only \'administer users\' cannot view the page.'));
$this
->drupalLogout();
$this
->drupalLogin($this->user_high);
$this
->drupalGet("user/{$this->user_low->uid}/roles");
$this
->assertResponse(200, t('Users with assign role permissions should be able to access the page.'));
$this
->drupalLogout();
$this
->drupalLogin($this->user_low);
$this
->drupalGet("user/{$this->user_low->uid}/roles");
$this
->assertResponse(403, t('Users without assign role permissions should not be able to access the page.'));
}