function SimplenewsTestBase::setupSubscriptionBlock in Simplenews 8
Enable newsletter subscription block.
Parameters
array $settings: ['newsletters'] = Array of newsletters (id => 1) ['message'] = Block message ['link_previous'] = {1, 0} Display link to previous issues ['rss_feed'] = {1, 0} Display RSS-feed icon
4 calls to SimplenewsTestBase::setupSubscriptionBlock()
- SimplenewsAdministrationTest::testSubscriptionManagement in src/
Tests/ SimplenewsAdministrationTest.php - Test newsletter subscription management.
- SimplenewsSubscribeTest::testSubscribeAnonymous in src/
Tests/ SimplenewsSubscribeTest.php - testSubscribeAnonymous
- SimplenewsSubscribeTest::testSubscribeAnonymousSingle in src/
Tests/ SimplenewsSubscribeTest.php - Test anonymous subscription with single opt in.
- SimplenewsSubscribeTest::testSubscribeAuthenticated in src/
Tests/ SimplenewsSubscribeTest.php - testSubscribeAuthenticated
File
- src/
Tests/ SimplenewsTestBase.php, line 92 - Simplenews test functions.
Class
- SimplenewsTestBase
- Base class for simplenews web tests.
Namespace
Drupal\simplenews\TestsCode
function setupSubscriptionBlock($settings = array()) {
$settings += [
'newsletters' => array(),
'message' => t('Select the newsletter(s) to which you want to subscribe or unsubscribe.'),
'unique_id' => \Drupal::service('uuid')
->generate(),
];
// Simplify confirmation form submission by hiding the subscribe block on
// that page. Same for the newsletter/subscriptions page.
$settings['visibility']['request_path']['pages'] = "newsletter/confirm/*\nnewsletter/subscriptions";
$settings['visibility']['request_path']['negate'] = TRUE;
$settings['region'] = 'sidebar_first';
$block = $this
->drupalPlaceBlock('simplenews_subscription_block', $settings);
$this
->assertTrue($block
->id());
return $block;
}