function UserRegistrationTest::testRegistrationEmailDuplicates in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/user/src/Tests/UserRegistrationTest.php \Drupal\user\Tests\UserRegistrationTest::testRegistrationEmailDuplicates()
File
- core/modules/user/src/Tests/UserRegistrationTest.php, line 131
- Contains \Drupal\user\Tests\UserRegistrationTest.
Class
- UserRegistrationTest
- Tests registration of user under different configurations.
Namespace
Drupal\user\Tests
Code
function testRegistrationEmailDuplicates() {
$this
->config('user.settings')
->set('verify_mail', FALSE)
->set('register', USER_REGISTER_VISITORS)
->save();
$duplicate_user = $this
->drupalCreateUser();
$edit = array();
$edit['name'] = $this
->randomMachineName();
$edit['mail'] = $duplicate_user
->getEmail();
$this
->drupalPostForm('user/register', $edit, t('Create new account'));
$this
->assertText(t('The email address @email is already taken.', array(
'@email' => $duplicate_user
->getEmail(),
)), 'Supplying an exact duplicate email address displays an error message');
$edit['mail'] = ' ' . $duplicate_user
->getEmail() . ' ';
$this
->drupalPostForm('user/register', $edit, t('Create new account'));
$this
->assertText(t('The email address @email is already taken.', array(
'@email' => $duplicate_user
->getEmail(),
)), 'Supplying a duplicate email address with added whitespace displays an error message');
}