public function PasswordPolicyExpirationTestCase::testAdminExpirationDisabled in Password Policy 7
Tests "Admin (UID=1) password expires" being disabled (i.e., unchecked).
File
- tests/
password_policy_expiration.test, line 305 - Tests for Password policy module expiration functionality.
Class
- PasswordPolicyExpirationTestCase
- Tests of password expiration.
Code
public function testAdminExpirationDisabled() {
$this
->disableAdminExpiration();
// Set an expiration policy.
$expiration_days = 30;
$this
->setExpirationPolicy($expiration_days);
$this
->cronRun();
// Advance to at least one second past expiration.
$one_day = 24 * 60 * 60;
_password_policy_advance_test_clock($expiration_days * $one_day + 1);
$this
->cronRun();
// Attempt login as admin and confirm password not expired.
$admin = $this->admin;
$edit = array(
'name' => $admin->name,
'pass' => $admin->pass_raw,
);
$this
->drupalPost('user/login', $edit, t('Log in'));
$this
->assertNoText(t('The username !name has not been activated or is blocked.', array(
'!name' => $admin->name,
)), 'Admin not blocked from logging in.');
}