public function SimplenewsPersonalizationFormsTest::testBlockedSubscribe in Simplenews 3.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/SimplenewsPersonalizationFormsTest.php \Drupal\Tests\simplenews\Functional\SimplenewsPersonalizationFormsTest::testBlockedSubscribe()
Blocked account subscribes, display message.
File
- tests/
src/ Functional/ SimplenewsPersonalizationFormsTest.php, line 146
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
->drupalGet("user/{$uid}/edit");
$this
->submitForm([
'status' => 0,
], 'Save');
$this
->drupalLogout();
// Attempt subscribe and assert "blocked" message.
$this
->subscribe([], $email);
$this
->assertRaw(t('The email address %mail belongs to a blocked user.', [
'%mail' => $email,
]));
}