public function SimplenewsPersonalizationFormsTest::testDeleteAccount in Simplenews 8.2
Same name and namespace in other branches
- 3.x tests/src/Functional/SimplenewsPersonalizationFormsTest.php \Drupal\Tests\simplenews\Functional\SimplenewsPersonalizationFormsTest::testDeleteAccount()
Delete account, subscriptions deleted.
File
- tests/
src/ Functional/ SimplenewsPersonalizationFormsTest.php, line 135
Class
- SimplenewsPersonalizationFormsTest
- Tests crucial aspects of Subscriber fieldability and User field sync.
Namespace
Drupal\Tests\simplenews\FunctionalCode
public function testDeleteAccount() {
$email = $this
->randomEmail();
// Register account.
$uid = $this
->registerUser($email);
// Subscribe.
$this
->subscribe('default', $email);
// Delete account.
$this
->drupalLogin($this->admin);
$this
->drupalPostForm("user/{$uid}/cancel", [
'user_cancel_method' => 'user_cancel_reassign',
], t('Cancel account'));
// Assert subscriptions are deleted.
$subscriber = $this
->getLatestSubscriber();
$this
->assertNull($subscriber, 'No subscriber found');
}