You are here

private function AdministerUsersByRoleTestCase::createUserWithRole in Administer Users by Role 6

Same name and namespace in other branches
  1. 7.2 administerusersbyrole.test \AdministerUsersByRoleTestCase::createUserWithRole()
  2. 7 administerusersbyrole.test \AdministerUsersByRoleTestCase::createUserWithRole()
2 calls to AdministerUsersByRoleTestCase::createUserWithRole()
AdministerUsersByRoleTestCase::createRolesAndUsers in ./administerusersbyrole.test
AdministerUsersByRoleTestCase::setUp in ./administerusersbyrole.test
Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…

File

./administerusersbyrole.test, line 20
Test Administer Users by Role.

Class

AdministerUsersByRoleTestCase
@file Test Administer Users by Role.

Code

private function createUserWithRole($userName, $roleNames) {
  $roleIDs = array();
  foreach ($roleNames as $roleName) {
    $roleIDs[$this->roles[$roleName]] = $this->roles[$roleName];
  }
  $userInfo = array(
    'name' => $userName,
    'mail' => "{$userName}@example.com",
    'pass' => 'cheese',
    'roles' => $roleIDs,
    'status' => 1,
  );
  $this->users[$userName] = user_save(NULL, $userInfo);
  $this->users[$userName]->pass_raw = 'cheese';
  $this
    ->assertTrue($this->users[$userName]->uid > 0, "Unable to create user {$userName}.");
}