You are here

protected function UserProtectWebTestBase::assertUserCanChangeMail in User protect 7

Asserts that a account's mail address can be changed.

Parameters

object $account: The account to change the mail address for.

string $message: (optional) The message to assert.

File

tests/UserProtectWebTestBase.test, line 286
Contains \UserProtectWebTestBase.

Class

UserProtectWebTestBase
Base class for User protect web tests.

Code

protected function assertUserCanChangeMail($account, $message = NULL) {
  if (!is_null($message)) {
    $message = "The user's mail address can be changed.";
  }
  $edit = array(
    'mail' => $this
      ->randomName() . '@example.com',
  );
  $this
    ->drupalPost('user/' . $account->uid . '/edit', $edit, t('Save'));

  // Re-load the user and assert the user name address changed.
  $account = user_load($account->uid, TRUE);
  $this
    ->assertEqual($edit['mail'], $account->mail, $message);
}