protected function UserProtectPermissionsWebTest::testEditOwnMail in User protect 7
Tests edit mail with permission "change own e-mail".
Tests if an user with the permission "change own e-mail" can edit its own mail.
File
- tests/
UserProtectPermissionsWebTest.test, line 76 - Contains UserProtectPermissionsWebTest.
Class
- UserProtectPermissionsWebTest
- Tests permissions.
Code
protected function testEditOwnMail() {
// Create account that may edit its own mail address.
$account = $this
->drupalCreateUser(array(
'change own e-mail',
'edit own account',
));
$this
->drupalLogin($account);
$edit = array(
'mail' => $this
->randomName() . '@example.com',
);
$this
->drupalPost('user/' . $account->uid . '/edit', $edit, t('Save'));
// Assert the mail address changed.
$account = user_load($account->uid, TRUE);
$this
->assertEqual($edit['mail'], $account->mail, "The user has changed its own mail address.");
}