protected function SpacesOGTestAutocomplete::createNamedUser in Spaces 7
Same name and namespace in other branches
- 6.3 spaces_og/tests/spaces_og.test \SpacesOGTestAutocomplete::createNamedUser()
- 7.3 spaces_og/tests/spaces_og.test \SpacesOGTestAutocomplete::createNamedUser()
1 call to SpacesOGTestAutocomplete::createNamedUser()
- SpacesOGTestAutocomplete::testAutocomplete in spaces_og/
tests/ spaces_og.test - Test autocomplete.
File
- spaces_og/
tests/ spaces_og.test, line 744
Class
Code
protected function createNamedUser($permissions = NULL, $name = NULL) {
// Create a role with the given permission set.
if (!($rid = $this
->drupalCreateRole($permissions))) {
return FALSE;
}
// Create a user assigned to that role.
$edit = array();
$edit['name'] = isset($name) ? $name : $this
->randomName();
$edit['mail'] = $edit['name'] . '@example.com';
$edit['roles'] = array(
$rid => $rid,
);
$edit['pass'] = user_password();
$edit['status'] = 1;
$account = user_save('', $edit);
$this
->assertTrue(!empty($account->uid), t('User created with name %name and pass %pass', array(
'%name' => $edit['name'],
'%pass' => $edit['pass'],
)), t('User login'));
if (empty($account->uid)) {
return FALSE;
}
// Add the raw password so that we can log in as this user.
$account->pass_raw = $edit['pass'];
return $account;
}