function AutoassignroleUserCreationTestCase::testUserCreateAPI in Auto Assign Role 7
Same name and namespace in other branches
- 7.2 autoassignrole.test \AutoassignroleUserCreationTestCase::testUserCreateAPI()
Test functionality for programmatic user creation.
See also
File
- ./
autoassignrole.test, line 751 - 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->rid => $this->rid,
));
// 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');
}