protected function PasswordPolicyAuthmapTestCase::enablePolicy in Password Policy 7
Enables policy.
Parameters
string $policy_name: Name of policy to be enabled.
1 call to PasswordPolicyAuthmapTestCase::enablePolicy()
- PasswordPolicyAuthmapTestCase::setTestPolicy in tests/
password_policy_authmap.test - Sets test policy.
File
- tests/
password_policy_authmap.test, line 147 - Functional tests for excluding authentication modules from policies.
Class
- PasswordPolicyAuthmapTestCase
- Tests of basic Password Policy constraints.
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.');
}