You are here

public function PasswordPolicyExpirationTestCase::testWarningEmailsDisabled in Password Policy 7

Tests warning e-mails not sent when they are disabled.

Limitation: This method does not test that e-mails are not sent on the exact second of expiration.

File

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

Class

PasswordPolicyExpirationTestCase
Tests of password expiration.

Code

public function testWarningEmailsDisabled() {
  $expiration_days = 2;
  $rid = DRUPAL_AUTHENTICATED_RID;
  $warning = '';
  $this
    ->setExpirationPolicy($expiration_days, $rid, $warning);

  // Run cron at least one second past two days before expiration.
  // By "day" in the rest of this method, a 24-hour period of time is meant,
  // not a calendar day.
  $one_day = 24 * 60 * 60;
  _password_policy_advance_test_clock($one_day + 1);
  $this
    ->cronRun();

  // Run cron at least one second past day before expiration.
  _password_policy_advance_test_clock($one_day);
  $this
    ->cronRun();

  // Run cron at least one second past expiration.
  _password_policy_advance_test_clock($one_day);
  $this
    ->cronRun();
  $this
    ->assertNoMail('No e-mails sent.');
}