function UserRegistrationTestCase::testRegistrationEmailDuplicates in Drupal 7
File
- modules/user/user.test, line 111
- Tests for user.module.
Class
- UserRegistrationTestCase
- @file
Tests for user.module.
Code
function testRegistrationEmailDuplicates() {
variable_set('user_email_verification', FALSE);
variable_set('user_register', USER_REGISTER_VISITORS);
$duplicate_user = $this
->drupalCreateUser();
$edit = array();
$edit['name'] = $this
->randomName();
$edit['mail'] = $duplicate_user->mail;
$this
->drupalPost('user/register', $edit, t('Create new account'));
$this
->assertText(t('The e-mail address @email is already registered.', array(
'@email' => $duplicate_user->mail,
)), 'Supplying an exact duplicate email address displays an error message');
$edit['mail'] = ' ' . $duplicate_user->mail . ' ';
$this
->drupalPost('user/register', $edit, t('Create new account'));
$this
->assertText(t('The e-mail address @email is already registered.', array(
'@email' => $duplicate_user->mail,
)), 'Supplying a duplicate email address with added whitespace displays an error message');
}