public function UserRestrictionsLoginTest::testUserRestrictionsCheckMailBlacklist in User restrictions 8
Ensure a user cannot log in if their email is on the blacklist.
File
- tests/
src/ Functional/ UserRestrictionsLoginTest.php, line 45
Class
- UserRestrictionsLoginTest
- Tests login restrictions.
Namespace
Drupal\Tests\user_restrictions\FunctionalCode
public function testUserRestrictionsCheckMailBlacklist() {
$this
->drupalGet('user/register');
$mail = $this
->randomMachineName() . '@' . $this
->randomMachineName() . '.ru';
$edit = [];
$edit['name'] = $this
->randomMachineName();
$edit['mail'] = $mail;
$this
->drupalPostForm('user/register', $edit, t('Create new account'));
$text = (string) new FormattableMarkup('The email <em class="placeholder">@mail</em> is reserved, and cannot be used.', [
'@mail' => $mail,
]);
$this
->assertRaw((string) $text, 'User "email" restricted.');
}