You are here

public function SimplenewsPersonalizationFormsTest::testDisableAccount in Simplenews 8

Disable account, subscriptions inactive.

File

src/Tests/SimplenewsPersonalizationFormsTest.php, line 111

Class

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

Namespace

Drupal\simplenews\Tests

Code

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

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

  // Subscribe.
  $this
    ->resetPassLogin(User::load($uid));
  $this
    ->subscribe('default', NULL, array(), t('Update'));
  $this
    ->drupalLogout();

  // Disable account.
  $this
    ->drupalLogin($this->admin);
  $this
    ->drupalPostForm("user/{$uid}/cancel", array(), t('Cancel account'));

  // Assert subscriber is inactive.
  $subscriber = $this
    ->getLatestSubscriber();
  $this
    ->assertFalse($subscriber
    ->getStatus());
}