You are here

protected function PasswordPolicyAdministratorPasswordChangeTestCase::setPolicyThatAppliesToNewRole in Password Policy 7

Set a password policy that applies just to the non-administrator.

A password policy is created that applies to the role only the non-administrator has. Then, it is enabled.

1 call to PasswordPolicyAdministratorPasswordChangeTestCase::setPolicyThatAppliesToNewRole()
PasswordPolicyAdministratorPasswordChangeTestCase::testAdministratorPasswordChange in tests/password_policy.test
Tests administrator changing password of another user.

File

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

Class

PasswordPolicyAdministratorPasswordChangeTestCase
Tests administrator changing password of another user.

Code

protected function setPolicyThatAppliesToNewRole() {
  $rid = $this
    ->drupalCreateRole(array());
  $policy_name = $this
    ->randomName();
  $edit = array(
    'name' => $policy_name,
    "roles[{$rid}]" => $rid,
    'constraint_length' => 4,
  );
  $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;
}