public function PasswordPolicyAuthmapTestCase::testExcludingAuthenticationModules in Password Policy 7
Tests excluding authentication modules.
File
- tests/
password_policy_authmap.test, line 72 - Functional tests for excluding authentication modules from policies.
Class
- PasswordPolicyAuthmapTestCase
- Tests of basic Password Policy constraints.
Code
public function testExcludingAuthenticationModules() {
$account = $this->userNoAuthenticationModule;
$this
->drupalLogin($account);
$pass = 'foo';
$edit = array(
'current_pass' => $account->pass_raw,
'pass[pass1]' => $pass,
'pass[pass2]' => $pass,
);
$this
->drupalPost('user/' . $account->uid . '/edit', $edit, t('Save'));
$this
->assertText(t('Password must be at least 4 characters in length.'), 'Password not accepted for user not authenticated by authentication module.');
$this
->drupalLogout();
$account = $this->userAuthenticationModuleOne;
$this
->drupalLogin($account);
$pass = 'foo';
$edit = array(
'current_pass' => $account->pass_raw,
'pass[pass1]' => $pass,
'pass[pass2]' => $pass,
);
$this
->drupalPost('user/' . $account->uid . '/edit', $edit, t('Save'));
$this
->assertText(t('The changes have been saved.'), 'Password accept for user whose authentication module is excluded from policy.');
$this
->drupalLogout();
$account = $this->userAuthenticationModuleTwo;
$this
->drupalLogin($account);
$pass = 'foo';
$edit = array(
'current_pass' => $account->pass_raw,
'pass[pass1]' => $pass,
'pass[pass2]' => $pass,
);
$this
->drupalPost('user/' . $account->uid . '/edit', $edit, t('Save'));
$this
->assertText(t('Password must be at least 4 characters in length.'), 'Password not accepted for user authentication whose module is not excluded from policy.');
$this
->drupalLogout();
}