You are here

protected function PasswordPolicyExpirationTestCase::enablePolicy in Password Policy 7

Enables policy.

2 calls to PasswordPolicyExpirationTestCase::enablePolicy()
PasswordPolicyExpirationTestCase::setExpirationPolicy in tests/password_policy_expiration.test
Sets expiration policy.
PasswordPolicyExpirationTestCase::testExpirationConstraint in tests/password_policy_expiration.test
Tests expiration constraint.

File

tests/password_policy_expiration.test, line 555
Tests for Password policy module expiration functionality.

Class

PasswordPolicyExpirationTestCase
Tests of password expiration.

Code

protected function enablePolicy($policy_name) {
  $pid = db_query('SELECT pid FROM {password_policy} WHERE name = :name', array(
    ':name' => $policy_name,
  ))
    ->fetchField();
  $edit = array(
    "policies[{$pid}][enabled]" => $pid,
  );
  $this
    ->drupalPost('admin/config/people/password_policy/list', $edit, t('Save changes'));
  $this
    ->assertText(t('The changes have been saved.'), 'Form submitted successfully.');
  $this
    ->drupalGet('admin/config/people/password_policy');
  $enabled = db_query('SELECT enabled FROM {password_policy} WHERE pid = :pid', array(
    ':pid' => $pid,
  ))
    ->fetchField();
  $this
    ->assertTrue($enabled == 1, 'Policy enabled.');
}