public function SimplenewsPersonalizationFormsTest::testBlockedSubscribe in Simplenews 8.2
Same name and namespace in other branches
- 3.x tests/src/Functional/SimplenewsPersonalizationFormsTest.php \Drupal\Tests\simplenews\Functional\SimplenewsPersonalizationFormsTest::testBlockedSubscribe()
Blocked account subscribes, display message.
File
- tests/
src/ Functional/ SimplenewsPersonalizationFormsTest.php, line 156
Class
- SimplenewsPersonalizationFormsTest
- Tests crucial aspects of Subscriber fieldability and User field sync.
Namespace
Drupal\Tests\simplenews\FunctionalCode
public function testBlockedSubscribe() {
$email = $this
->randomEmail();
// Register account.
$uid = $this
->registerUser($email);
// Block account.
$this
->drupalLogin($this->admin);
$this
->drupalPostForm("user/{$uid}/edit", [
'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.', [
'%mail' => $email,
]));
}