You are here

function AutoassignroleAdminUserTestCase::testAdminUserSelectionRequired in Auto Assign Role 7.2

Same name and namespace in other branches
  1. 7 autoassignrole.test \AutoassignroleAdminUserTestCase::testAdminUserSelectionRequired()

Test admin setting functionality for autoassignrole_user_selection.

See also

http://drupal.org/node/944978

File

./autoassignrole.test, line 421
Creates tests for auto assign role module.

Class

AutoassignroleAdminUserTestCase
Extend the DrupalWebTestCase.

Code

function testAdminUserSelectionRequired() {

  // 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_required', 'The autoassignrole_user_required field is accessible.');

  // Set autoassignrole_user_required to no.
  $edit['autoassignrole_user_required'] = 0;
  $this
    ->drupalPost('admin/config/people/autoassignrole/user', $edit, t('Save configuration'));

  // Verify autoassignrole_user_required has set to no.
  $this
    ->assertEqual(variable_get('autoassignrole_user_required', -1), 0, 'autoassignrole_user_required has been set to radio');

  // Set autoassignrole_user_required to yes.
  $edit['autoassignrole_user_required'] = 1;
  $this
    ->drupalPost('admin/config/people/autoassignrole/user', $edit, t('Save configuration'));

  // Verify autoassignrole_user_required has been set to yes.
  $this
    ->assertEqual(variable_get('autoassignrole_user_required', -1), 1, 'autoassignrole_user_required has been set to select box');
}