function UserEditTest::testUserWithoutEmailEdit

Tests editing of a user account without an e-mail address.

File

drupal/core/modules/user/lib/Drupal/user/Tests/UserEditTest.php, line 84
Definition of Drupal\user\Tests\UserEditTest.

Class

UserEditTest
Tests the user edit form.

Namespace

Drupal\user\Tests

Code

function testUserWithoutEmailEdit() {

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

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

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