You are here

function EmailConfirmTestCase::adminChangeEmail in Email Change Confirmation 7

Tests admin changing email doesn't require email confirm.

File

tests/email_confirm.test, line 161
Tests for Email Confirm module.

Class

EmailConfirmTestCase
@file Tests for Email Confirm module.

Code

function adminChangeEmail() {
  $this
    ->drupalLogin($this->admin_user);
  $new_mail = $this
    ->randomName() . '@example.com';
  $edit = array();
  $edit['mail'] = $new_mail;
  $this
    ->drupalPost("user/" . $this->web_user->uid . "/edit", $edit, t('Save'));
  $this
    ->assertNoText(t("A confirmation email has been sent to your new email address. You must follow the link provided in that email within 24 hours in order to confirm the change to your account email address."));
  $this
    ->assertNoText($this->web_user->mail);
  $this
    ->assertText($new_mail);

  // Assert user's mail was changed.
  $account = user_load($this->web_user->uid);
  $this
    ->assertNotIdentical($account->mail, $this->web_user->mail);
  $this
    ->assertIdentical($account->mail, $new_mail);
}