You are here

function AutoassignroleAdminAllowUserChoiceTestCase::testAdminSettings in Auto Assign Role 6.2

Same name and namespace in other branches
  1. 6 tests/autoassignrole.test \AutoassignroleAdminAllowUserChoiceTestCase::testAdminSettings()

File

tests/autoassignrole.test, line 259
Autoassignrole functionality tests.

Class

AutoassignroleAdminAllowUserChoiceTestCase

Code

function testAdminSettings() {

  // 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/user/autoassignrole');
  $this
    ->assertRaw('Automatic Role Assignment', 'The Automatic Role Assignment section exists on the AAR admin page');
  $edit = $this
    ->getEditValues('user_choice');

  // if User role Selection is set to Multiple Roles then Selection Method can
  // not be Radio Buttons
  $edit['user_multiple'] = 1;
  $edit['user_selection'] = 0;
  $this
    ->drupalPost('admin/user/autoassignrole', $edit, t('Save'));
  $this
    ->assertNotEqual($edit['user_active'], _autoassignrole_get_settings('user_active'), 'Allow User to Choose: user_active failed validation correctly if role Selection is set to Multiple Roles then Selection Method can not be Radio Buttons');

  // Get the form to pass validation
  $edit['user_multiple'] = 0;
  $this
    ->drupalPost('admin/user/autoassignrole', $edit, t('Save'));

  // verify that our changes were saved
  foreach ($edit as $key => $value) {
    $this
      ->assertEqual($value, _autoassignrole_get_settings($key), 'Allow User to Choose: ' . $key . ' was set properly');
  }
}