diff --git a/core/modules/user/src/Tests/UserRegistrationTest.php b/core/modules/user/src/Tests/UserRegistrationTest.php index 01418b7..2d59827 100644 --- a/core/modules/user/src/Tests/UserRegistrationTest.php +++ b/core/modules/user/src/Tests/UserRegistrationTest.php @@ -194,19 +194,18 @@ function testRegistrationDefaultValues() { } /** - * Ensures that you cannot register with the same name / mail twice. + * Tests registration errors when trying to register with an existing user + * name or an existing email address. * * @see \Drupal\user\Plugin\Validation\Constraint\UserNameUnique * @see \Drupal\user\Plugin\Validation\Constraint\UserMailUnique */ public function testUniqueFields() { - $account = $this->drupalCreateUser([]); + $account = $this->drupalCreateUser(); - // Existing username. $this->drupalPostForm('user/register', ['mail' => 'test@example.com', 'name' => $account->getUsername()], t('Create new account')); $this->assertRaw(Safemarkup::format('The username %value is already taken.', ['%value' => $account->getUsername()])); - // Existing mail address. $this->drupalPostForm('user/register', ['mail' => $account->getEmail(), 'name' => $this->randomString()], t('Create new account')); $this->assertRaw(Safemarkup::format('The email address %value is already taken.', ['%value' => $account->getEmail()])); }