You are here

protected function UserProtectProtectionWebTest::testPassProtection in User protect 7

Tests if the user's password field has the expected protection.

File

tests/UserProtectProtectionWebTest.test, line 98
Contains UserProtectProtectionWebTest.

Class

UserProtectProtectionWebTest
Tests creating, editing and deleting protection rules through the UI.

Code

protected function testPassProtection() {
  $protected_account = $this
    ->createProtectedUser(array(
    'up_pass' => 1,
  ));

  // Remember the user's pass.
  $expected_pass = $protected_account->pass_raw;
  $new_pass = $this
    ->randomName();
  $edit = array(
    'pass[pass1]' => $new_pass,
    'pass[pass2]' => $new_pass,
  );
  $this
    ->userprotectPostForm('user/' . $protected_account->uid . '/edit', $edit, t('Save'));

  // Try to login as this user with the expected password.
  $protected_account = user_load($protected_account->uid, TRUE);
  $protected_account->pass_raw = $expected_pass;
  $this
    ->drupalLogout();
  $this
    ->drupalLogin($protected_account);
}