You are here

function AutoassignroleAdminAutoTestCase::testAdminActiveSettings in Auto Assign Role 7.2

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

Test admin setting functionality for autoassignrole_admin_active.

See also

http://drupal.org/node/937666

File

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

Class

AutoassignroleAdminAutoTestCase
Extend the DrupalWebTestCase.

Code

function testAdminActiveSettings() {

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

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

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

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

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