public function SimplenewsSubscribeTest::testSimplenewsSubscriptionBlock in Simplenews 8
Tests Creation of Simplenews Subscription block.
File
- src/
Tests/ SimplenewsSubscribeTest.php, line 908 - Simplenews subscribe test functions.
Class
- SimplenewsSubscribeTest
- (un)subscription of anonymous and authenticated users.
Namespace
Drupal\simplenews\TestsCode
public function testSimplenewsSubscriptionBlock() {
$admin_user = $this
->drupalCreateUser(array(
'administer blocks',
));
$this
->drupalLogin($admin_user);
$this
->drupalGet('/admin/structure/block/add/simplenews_subscription_block/classy');
// Check for Unique ID field.
$this
->assertText('Unique ID');
$edit = array(
'settings[unique_id]' => 'test_simplenews_123',
'settings[newsletters][default]' => TRUE,
'region' => 'header',
);
$this
->drupalPostForm(NULL, $edit, t('Save block'));
$this
->drupalGet('');
// Provided Unique ID is used as form_id.
$this
->assertFieldByXPath("//*[@id=\"simplenews-subscriptions-block-test-simplenews-123\"]", NULL, 'Form ID found and contains expected value.');
}