You are here

protected function RequiredByRoleBasic::getRequiredUser in Required by role 7

Same name and namespace in other branches
  1. 7.2 tests/required_by_role_test/RequiredByRoleBasic.test \RequiredByRoleBasic::getRequiredUser()

Helper method to ghet a required user.

4 calls to RequiredByRoleBasic::getRequiredUser()
RequiredByRoleCommonWebTestCase::setUp in tests/required_by_role_test/RequiredByRoleCommonWebTestCase.test
Setup method.
RequiredByRoleDateFieldWebTestCase::DotestRequiredRole in tests/required_by_role_test/RequiredByRoleDateFieldWebTestCase.test
Test for required roles.
RequiredByRoleEmailFieldWebTestCase::setUp in tests/required_by_role_test/RequiredByRoleEmailFieldWebTestCase.test
Setup method.
RequiredByRoleImageFieldWebTestCase::testIsRequiredByRole in tests/required_by_role_test/RequiredByRoleImageFieldWebTestCase.test
Test for required and non-required roles

File

tests/required_by_role_test/RequiredByRoleBasic.test, line 55
Tests for Required by role module.

Class

RequiredByRoleBasic
Base class for all required by role web test cases.

Code

protected function getRequiredUser() {
  $account = self::$required_user;
  if (is_null($account)) {
    $account = $this
      ->drupalCreateUser($this->basePermissions);
    $edit = array();
    $edit['roles'] = array(
      $this->required_fields_rid => $this->required_fields_rid,
    );
    $account = user_save($account, $edit);
    self::$required_user = $account;
  }
  return $account;
}