You are here

protected function PasswordPolicyPasswordLengthRestrictionTestCase::setPolicyThatAppliesToAuthenticatedUser in Password Policy 7

Sets a password policy that applies to the authenticated user role.

This is just a minimal policy to apply to the admin (UID=1) user, which is being used for this test.

1 call to PasswordPolicyPasswordLengthRestrictionTestCase::setPolicyThatAppliesToAuthenticatedUser()
PasswordPolicyPasswordLengthRestrictionTestCase::testOverlongPasswordSubmission in tests/password_policy.test
Tests module response to submission of an overlong password.

File

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

Class

PasswordPolicyPasswordLengthRestrictionTestCase
Tests of restriction on password length.

Code

protected function setPolicyThatAppliesToAuthenticatedUser() {
  $rid = DRUPAL_AUTHENTICATED_RID;
  $policy_name = $this
    ->randomName();
  $edit = array(
    'name' => $policy_name,
    "roles[{$rid}]" => $rid,
    'constraint_alphanumeric' => 1,
  );
  $this
    ->drupalPost('admin/config/people/password_policy/add', $edit, t('Create'));
  $created_text = "Policy {$policy_name} has been created.";
  $this
    ->assertText($created_text, $created_text);
  $this
    ->enablePolicy($policy_name);
  $this->policyRid = $rid;
}