You are here

public function SimplenewsPersonalizationFormsTest::testSubscribeRequestPassword in Simplenews 8.2

Same name and namespace in other branches
  1. 3.x tests/src/Functional/SimplenewsPersonalizationFormsTest.php \Drupal\Tests\simplenews\Functional\SimplenewsPersonalizationFormsTest::testSubscribeRequestPassword()

Subscribe, request password: "name is not recognized".

File

tests/src/Functional/SimplenewsPersonalizationFormsTest.php, line 94

Class

SimplenewsPersonalizationFormsTest
Tests crucial aspects of Subscriber fieldability and User field sync.

Namespace

Drupal\Tests\simplenews\Functional

Code

public function testSubscribeRequestPassword() {
  $email = $this
    ->randomEmail();

  // Subscribe.
  $this
    ->subscribe('default', $email);

  // Request new password.
  $this
    ->drupalPostForm('user/password', [
    'name' => $email,
  ], t('Submit'));

  // Assert the email is not recognized as an account.
  $this
    ->assertRaw(t('%name is not recognized as a username or an email address.', [
    '%name' => $email,
  ]));
}