protected function UserProtectWebTestBase::createUserWithProtectedRole in User protect 7
Creates an user with a protected role.
Parameters
array $protections: (optional) The active protections. Defaults to an empty array.
Return value
object The created user.
File
- tests/
UserProtectWebTestBase.test, line 74 - Contains \UserProtectWebTestBase.
Class
- UserProtectWebTestBase
- Base class for User protect web tests.
Code
protected function createUserWithProtectedRole(array $protections = array()) {
// Create a protected role.
$rid = $this
->createProtectedRole($protections);
// Create an account with this protected role.
$protected_account = $this
->drupalCreateUser();
$protected_account->roles[$rid] = $rid;
user_save($protected_account);
return $protected_account;
}