function AutoassignroleAdminAutoRoleTestCase::testAdminSettings in Auto Assign Role 6
Same name and namespace in other branches
- 6.2 tests/autoassignrole.test \AutoassignroleAdminAutoRoleTestCase::testAdminSettings()
File
- tests/
autoassignrole.test, line 147 - Autoassignrole functionality tests.
Class
Code
function testAdminSettings() {
// Create a new user who can access the administration settings
$this
->drupalLogin($this->admin_user);
// Check that the user can see the admin settings page.
$this
->drupalGet('admin/user/autoassignrole');
$this
->assertRaw('Automatic Role Assignment', 'The Automatic Role Assignment section exists on the AAR admin page');
// Enable "Automatic role assignment" and enable all test roles
$edit = $this
->getEditValues('automatic_role_assignment');
$this
->drupalPost('admin/user/autoassignrole', $edit, t('Save'));
// Verify Automatic Role Assignment has been enabled
$this
->assertEqual(_autoassignrole_get_settings('auto_active'), 1, 'Automatic Role Assignment has been enabled');
$this
->validate($edit, 'Automatic Role Assignment');
// Disable "Automatic role assignment" and disable all test roles
$edit['auto_active'] = 0;
foreach ($this->roles as $rid => $role) {
$edit["auto_roles[{$rid}]"] = FALSE;
}
$this
->drupalPost('admin/user/autoassignrole', $edit, t('Save'));
$this
->validate($edit, 'Automatic Role Assignment');
}