You are here

protected function PasswordPolicyPasswordLengthRestrictionTestCase::createAdmin in Password Policy 7

Same name and namespace in other branches
  1. 7.2 password_policy.test \PasswordPolicyPasswordLengthRestrictionTestCase::createAdmin()

Creates a usable admin (UID=1) user.

SimpleTest creates an admin user, but it cannot log in since it has no password set. So, we give it a password. We also give it a valid email address so its user edit form can be submitted.

1 call to PasswordPolicyPasswordLengthRestrictionTestCase::createAdmin()
PasswordPolicyPasswordLengthRestrictionTestCase::setUp in tests/password_policy.test
Set up the test.

File

tests/password_policy.test, line 994
Functional tests for Password policy module.

Class

PasswordPolicyPasswordLengthRestrictionTestCase
Tests of restriction on password length.

Code

protected function createAdmin() {
  global $user;
  $pass = user_password();
  $edit = array(
    'pass' => $pass,
    'mail' => 'foo@example.com',
  );
  user_save($user, $edit);
  $user->pass_raw = $pass;
  $this->admin = $user;
}