You are here

function AutoassignroleAdminAutoTestCase::testAutoActiveSettings in Auto Assign Role 7

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

Test admin setting functionality for autoassignrole_auto_active.

See also

http://drupal.org/node/937468

File

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

Class

AutoassignroleAdminAutoTestCase
Extend the DrupalWebTestCase.

Code

function testAutoActiveSettings() {

  // 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/auto');
  $this
    ->assertField('autoassignrole_auto_active', 'The autoassignrole_auto_active field is accessible.');

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

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

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

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