You are here

protected function PasswordPolicyAdministratorPasswordChangeTestCase::attemptAdminPasswordChanges in Password Policy 7

Attempts to change password for administrator.

This checks that the password policy that is supposed to apply only to non-administrators does not also apply to administrators.

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

File

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

Class

PasswordPolicyAdministratorPasswordChangeTestCase
Tests administrator changing password of another user.

Code

protected function attemptAdminPasswordChanges() {
  $admin_uid = $this->admin->uid;
  $current_pass = $this->admin->pass_raw;
  $new_pass = 'foo';
  $edit = array(
    // Set a new e-mail address because the default will not pass validation.
    'mail' => 'foo@example.com',
    'current_pass' => $current_pass,
    'pass[pass1]' => $new_pass,
    'pass[pass2]' => $new_pass,
  );
  $this
    ->drupalPost('user/' . $admin_uid . '/edit', $edit, t('Save'));
  $this
    ->assertText(t('The changes have been saved.'), 'Password accepted for administrator, who has no policy that applies to their roles.');
}