You are here

function AutoassignroleUserCreationTestCase::testUserCreateAPI in Auto Assign Role 7.2

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

Test functionality for programmatic user creation.

See also

http://drupal.org/node/944864

File

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

Class

AutoassignroleUserCreationTestCase
Extend the DrupalWebTestCase.

Code

function testUserCreateAPI() {

  // Enable auto role assignment.
  variable_set('autoassignrole_auto_active', 1);

  // Enable auto assignment for admin users.
  variable_set('autoassignrole_admin_active', 1);

  // Configure to assign our random role.
  variable_set('autoassignrole_auto_roles', array(
    $this->role => $this->role,
  ));

  // Create a test user.
  $this->test_user = $this
    ->drupalCreateUser();

  // Verify test user has been assigned role.
  $this
    ->assertTRUE(array_key_exists($this->rid, $this->test_user->roles), 'Programmatic creation of user is automatically assigned role');
}