You are here

function AutoassignroleAdminUserTestCase::testAdminUserMultipleSettings in Auto Assign Role 7

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

Test admin setting functionality for autoassignrole_user_multiple.

See also

http://drupal.org/node/944944

File

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

Class

AutoassignroleAdminUserTestCase
Extend the DrupalWebTestCase.

Code

function testAdminUserMultipleSettings() {

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

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

  // Verify autoassignrole_user_multiple has been enabled.
  $this
    ->assertEqual(variable_get('autoassignrole_user_multiple', 0), 1, 'autoassignrole_user_multiple has been enabled');

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

  // Verify autoassignrole_user_multiple has been disabled.
  $this
    ->assertEqual(variable_get('autoassignrole_user_multiple', 1), 0, 'autoassignrole_user_multiple has been disabled');
}