You are here

function AutoassignroleAdminUserTestCase::testAdminUserSortSettings in Auto Assign Role 7

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

Test admin setting functionality for autoassignrole_user_selection.

See also

http://drupal.org/node/944988

File

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

Class

AutoassignroleAdminUserTestCase
Extend the DrupalWebTestCase.

Code

function testAdminUserSortSettings() {

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

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

  // Verify autoassignrole_user_sort has set to SORT_ASC
  $this
    ->assertEqual(variable_get('autoassignrole_user_sort', -1), 'SORT_ASC', 'autoassignrole_user_selection has been set to SORT_ASC');

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

  // Verify autoassignrole_user_sort has been set to 'SORT_DESC'
  $this
    ->assertEqual(variable_get('autoassignrole_user_sort', -1), 'SORT_DESC', 'autoassignrole_user_sort has been set to SORT_DESC');
}