protected function UserProtectWebTestBase::assertUserNoCanChangeMail in User protect 7
Asserts that a account's mail address can NOT 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 309 - Contains \UserProtectWebTestBase.
Class
- UserProtectWebTestBase
- Base class for User protect web tests.
Code
protected function assertUserNoCanChangeMail($account, $message = NULL) {
if (!is_null($message)) {
$message = "The user's mail address can NOT be changed.";
}
// Remember the user's name.
$expected_mail = $account->mail;
$edit = array(
'mail' => $this
->randomName() . '@example.com',
);
$this
->userprotectPostForm('user/' . $account->uid . '/edit', $edit, t('Save'));
// Re-load the user and check the user name didn't change.
$account = user_load($account->uid, TRUE);
$this
->assertEqual($expected_mail, $account->mail, $message);
}