You are here

function SimplenewsTestBase::setUpSubscribers in Simplenews 8

9 calls to SimplenewsTestBase::setUpSubscribers()
SimplenewsSendTest::setUp in src/Tests/SimplenewsSendTest.php
Sets up a Drupal site for running functional and integration tests.
SimplenewsSourceTest::testSendCaching in src/Tests/SimplenewsSourceTest.php
Test sending a newsletter to 100 recipients with caching enabled.
SimplenewsSourceTest::testSendHidden in src/Tests/SimplenewsSourceTest.php
Send a issue with the newsletter set to hidden.
SimplenewsSourceTest::testSendHTML in src/Tests/SimplenewsSourceTest.php
Send a newsletter with the HTML format.
SimplenewsSourceTest::testSendMissingNode in src/Tests/SimplenewsSourceTest.php
Test sending when the issue node is missing.

... See full list

File

src/Tests/SimplenewsTestBase.php, line 112
Simplenews test functions.

Class

SimplenewsTestBase
Base class for simplenews web tests.

Namespace

Drupal\simplenews\Tests

Code

function setUpSubscribers($count = 100, $newsletter_id = 'default') {

  // Subscribe users.
  $this->subscribers = array();
  for ($i = 0; $i < $count; $i++) {
    $mail = $this
      ->randomEmail();
    $this->subscribers[$mail] = $mail;
  }
  $this
    ->drupalGet('admin/people/simplenews');
  $this
    ->clickLink(t('Mass subscribe'));
  $edit = array(
    'emails' => implode(',', $this->subscribers),
    // @todo: Don't hardcode the default newsletter_id.
    'newsletters[' . $newsletter_id . ']' => TRUE,
  );
  $this
    ->drupalPostForm(NULL, $edit, t('Subscribe'));
}