function AutoassignroleAdminUserTestCase::testAdminUserSelectionSettings in Auto Assign Role 7.2
Same name and namespace in other branches
- 7 autoassignrole.test \AutoassignroleAdminUserTestCase::testAdminUserSelectionSettings()
Test admin setting functionality for autoassignrole_user_selection.
See also
File
- ./
autoassignrole.test, line 375 - Creates tests for auto assign role module.
Class
- AutoassignroleAdminUserTestCase
- Extend the DrupalWebTestCase.
Code
function testAdminUserSelectionSettings() {
// 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_selection', 'The autoassignrole_user_selection field is accessible.');
// Set autoassignrole_user_selection to radio inputs.
$edit['autoassignrole_user_selection'] = 0;
$this
->drupalPost('admin/config/people/autoassignrole/user', $edit, t('Save configuration'));
// Verify autoassignrole_user_selection has set to radio.
$this
->assertEqual(variable_get('autoassignrole_user_selection', -1), 0, 'autoassignrole_user_selection has been set to radio/ checkbox');
// Set autoassignrole_user_selection to select box.
$edit['autoassignrole_user_selection'] = 1;
$this
->drupalPost('admin/config/people/autoassignrole/user', $edit, t('Save configuration'));
// Verify autoassignrole_user_selection has been set to select box.
$this
->assertEqual(variable_get('autoassignrole_user_selection', -1), 1, 'autoassignrole_user_selection has been set to select box');
}