function UserEditTest::testUserWithoutEmailEdit

Tests editing of a user account without an email address.

File

core/modules/user/tests/src/Functional/UserEditTest.php, line 146

Class

UserEditTest
Tests user edit page.

Namespace

Drupal\Tests\user\Functional

Code

public function testUserWithoutEmailEdit() {
  // Test that an admin can edit users without an email address.
  $admin = $this->drupalCreateUser([
    'administer users',
  ]);
  $this->drupalLogin($admin);
  // Create a regular user.
  $user1 = $this->drupalCreateUser([]);
  // This user has no email address.
  $user1->mail = '';
  $user1->save();
  $this->drupalPostForm("user/" . $user1->id() . "/edit", [
    'mail' => '',
  ], t('Save'));
  $this->assertRaw(t("The changes have been saved."));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.