function AutoassignroleAdminUserTestCase::testAdminUserSettings in Auto Assign Role 7.2
Same name and namespace in other branches
- 7 autoassignrole.test \AutoassignroleAdminUserTestCase::testAdminUserSettings()
Test admin setting functionality for autoassignrole_user_active.
See also
File
- ./
autoassignrole.test, line 247 - Creates tests for auto assign role module.
Class
- AutoassignroleAdminUserTestCase
- Extend the DrupalWebTestCase.
Code
function testAdminUserSettings() {
// 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/config/people/autoassignrole/user');
$this
->assertField('autoassignrole_user_active', 'The autoassignrole_user_active field is accessible.');
// Enable autoassignrole_user_active.
$edit['autoassignrole_user_active'] = 1;
$this
->drupalPost('admin/config/people/autoassignrole/user', $edit, t('Save configuration'));
// Verify autoassignrole_user_active has been enabled.
$this
->assertEqual(variable_get('autoassignrole_user_active', 0), 1, 'autoassignrole_user_active has been enabled');
// Disable autoassignrole_user_active
$edit['autoassignrole_user_active'] = 0;
$this
->drupalPost('admin/config/people/autoassignrole/user', $edit, t('Save configuration'));
// Verify autoassignrole_user_active has been disabled.
$this
->assertEqual(variable_get('autoassignrole_user_active', 1), 0, 'autoassignrole_user_active has been disabled');
}