public function SimplenewsRecipientHandlerTest::testSiteMail in Simplenews 8.2
Same name and namespace in other branches
- 3.x tests/src/Functional/SimplenewsRecipientHandlerTest.php \Drupal\Tests\simplenews\Functional\SimplenewsRecipientHandlerTest::testSiteMail()
Tests the "site mail" recipient handler.
File
- tests/
src/ Functional/ SimplenewsRecipientHandlerTest.php, line 43
Class
- SimplenewsRecipientHandlerTest
- Test cases for creating and sending newsletters.
Namespace
Drupal\Tests\simplenews\FunctionalCode
public function testSiteMail() {
// Verify that the recipient handler settings are shown.
$this
->drupalGet('node/add/simplenews_issue');
$this
->assertText(t('Recipients'));
$this
->assertText(t('How recipients should be selected.'));
$edit = [
'title[0][value]' => $this
->randomString(10),
'simplenews_issue[target_id]' => 'default',
'simplenews_issue[handler]' => 'simplenews_site_mail',
];
$this
->drupalPostForm(NULL, $edit, t('Save'));
$this
->clickLink(t('Newsletter'));
$this
->assertText(t('Send newsletter issue to 1 subscribers.'));
$this
->drupalPostForm(NULL, [], t('Send now'));
$this
->checkRecipients([
'simpletest@example.com' => 1,
]);
}