You are here

public function PasswordPolicyForcePasswordChangeTestCase::testNewUserChange in Password Policy 7

Same name and namespace in other branches
  1. 6 tests/password_policy.test \PasswordPolicyForcePasswordChangeTestCase::testNewUserChange()

Tests new user change.

File

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

Class

PasswordPolicyForcePasswordChangeTestCase
Tests of forcing password changes.

Code

public function testNewUserChange() {
  $admin = $this
    ->drupalCreateUser(array(
    'administer users',
    'force password change',
  ));
  $this
    ->drupalLogin($admin);
  $edit = array(
    'password_policy_new_login_change' => TRUE,
  );
  $this
    ->drupalPost('admin/config/people/password_policy/password_change', $edit, t('Save changes'));
  $this
    ->assertRaw(t('New users will be required to change their password on first-time login.'), 'New users required to change password on 1st login.');
  $this
    ->drupalLogout();
  $user = $this
    ->drupalCreateUser();
  $this
    ->drupalLogin($user);
  $this
    ->drupalGet('node');
  $this
    ->assertRaw(t('Your password has expired. You must change your password to proceed on the site.'), 'New user forced to change password.');
}