You are here

public function PasswordPolicyForcePasswordChangeTestCase::testNewUserChange in Password Policy 6

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

File

tests/password_policy.test, line 396
Unit tests for Password policy module.

Class

PasswordPolicyForcePasswordChangeTestCase

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/settings/password_policy/password_change', $edit, t('Submit'));
  $this
    ->assertRaw(t('New users will be required to change their password on first-time login.'), t('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.'), t('New user forced to change password.'));
}