You are here

protected function UserProtectProtectionWebTest::testMailProtection in User protect 7

Tests if the user's mail address field has the expected protection.

File

tests/UserProtectProtectionWebTest.test, line 79
Contains UserProtectProtectionWebTest.

Class

UserProtectProtectionWebTest
Tests creating, editing and deleting protection rules through the UI.

Code

protected function testMailProtection() {
  $protected_account = $this
    ->createProtectedUser(array(
    'up_mail' => 1,
  ));

  // Remember the user's mail address.
  $expected_mail = $protected_account->mail;
  $edit = array(
    'mail' => $this
      ->randomName() . '@example.com',
  );
  $this
    ->userprotectPostForm('user/' . $protected_account->uid . '/edit', $edit, t('Save'));

  // Re-load the user and check the user mail address didn't change.
  $protected_account = user_load($protected_account->uid, TRUE);
  $this
    ->assertEqual($expected_mail, $protected_account->mail);
}