You are here

function AutoassignroleAdminUserTestCase::testAdminUserTitle in Auto Assign Role 7

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

Test admin setting functionality for autoassignrole_user_title.

See also

http://drupal.org/node/945016

File

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

Class

AutoassignroleAdminUserTestCase
Extend the DrupalWebTestCase.

Code

function testAdminUserTitle() {

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

  // Set autoassignrole_user_title to a random string.
  $random_string = $this
    ->randomName();
  $edit['autoassignrole_user_title'] = $random_string;
  $this
    ->drupalPost('admin/config/people/autoassignrole/user', $edit, t('Save configuration'));

  // Verify autoassignrole_user_title has been saved.
  $this
    ->assertEqual(variable_get('autoassignrole_user_title', -1), $random_string, 'autoassignrole_user_title has been set to random string');
}