You are here

function UserEditTest::testUserWithoutEmailEdit in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/user/src/Tests/UserEditTest.php \Drupal\user\Tests\UserEditTest::testUserWithoutEmailEdit()

Tests editing of a user account without an email address.

File

core/modules/user/src/Tests/UserEditTest.php, line 132
Contains \Drupal\user\Tests\UserEditTest.

Class

UserEditTest
Tests user edit page.

Namespace

Drupal\user\Tests

Code

function testUserWithoutEmailEdit() {

  // Test that an admin can edit users without an email address.
  $admin = $this
    ->drupalCreateUser(array(
    'administer users',
  ));
  $this
    ->drupalLogin($admin);

  // Create a regular user.
  $user1 = $this
    ->drupalCreateUser(array());

  // This user has no email address.
  $user1->mail = '';
  $user1
    ->save();
  $this
    ->drupalPostForm("user/" . $user1
    ->id() . "/edit", array(
    'mail' => '',
  ), t('Save'));
  $this
    ->assertRaw(t("The changes have been saved."));
}