You are here

public function SimplenewsPersonalizationFormsTest::testBlockedSubscribe in Simplenews 8

Blocked account subscribes, display message.

File

src/Tests/SimplenewsPersonalizationFormsTest.php, line 155

Class

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

Namespace

Drupal\simplenews\Tests

Code

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

  // Register account.
  $uid = $this
    ->registerUser($email);

  // Block account.
  $this
    ->drupalLogin($this->admin);
  $this
    ->drupalPostForm("user/{$uid}/edit", array(
    'status' => 0,
  ), t('Save'));
  $this
    ->drupalLogout();

  // Attempt subscribe and assert "blocked" message.
  $this
    ->subscribe('default', $email);
  $this
    ->assertRaw(t('The email address %mail belongs to a blocked user.', array(
    '%mail' => $email,
  )));
}