You are here

function SimplenewsTestCase::setUpSubscribers in Simplenews 7

Same name and namespace in other branches
  1. 7.2 tests/simplenews.test \SimplenewsTestCase::setUpSubscribers()
7 calls to SimplenewsTestCase::setUpSubscribers()
SimplenewsSendTestCase::setUp in tests/simplenews.test
Sets up a Drupal site for running functional and integration tests.
SimplenewsSourceTestCase::testSendCaching in tests/simplenews.test
Test sending a newsletter to 100 recipients with caching enabled.
SimplenewsSourceTestCase::testSendHidden in tests/simplenews.test
Send a newsletter with the category set to hidden.
SimplenewsSourceTestCase::testSendHTML in tests/simplenews.test
Send a newsletter with the HTML format.
SimplenewsSourceTestCase::testSendMissingNode in tests/simplenews.test
Test with disabled caching.

... See full list

File

tests/simplenews.test, line 152
Simplenews test functions.

Class

SimplenewsTestCase
@file Simplenews test functions.

Code

function setUpSubscribers($count = 100, $tid = 1) {

  // 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 tid.
    'newsletters[' . $tid . ']' => TRUE,
  );
  $this
    ->drupalPost(NULL, $edit, t('Subscribe'));
}