You are here

function SimplenewsTestCase::randomEmail in Simplenews 7

Same name and namespace in other branches
  1. 6.2 tests/simplenews.test \SimplenewsTestCase::randomEmail()
  2. 7.2 tests/simplenews.test \SimplenewsTestCase::randomEmail()

Generates a random email address.

The generated addresses are stored in a class variable. Each generated adress is checked against this store to prevent duplicates.

@todo: Make this function redundant by modification of Simplenews. Email addresses are case sensitive, simplenews system should handle with this correctly.

9 calls to SimplenewsTestCase::randomEmail()
SimpleNewsAdministrationTestCase::testCategorySettings in tests/simplenews.test
Test various combinations of newsletter category settings.
SimpleNewsAdministrationTestCase::testSubscriptionManagement in tests/simplenews.test
Test newsletter subscription management.
SimpleNewsI18nTestCase::testContentTranslation in tests/simplenews.test
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.

... See full list

File

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

Class

SimplenewsTestCase
@file Simplenews test functions.

Code

function randomEmail($number = 4, $prefix = 'simpletest_', $domain = 'example.com') {
  $mail = '';
  do {
    $mail = drupal_strtolower($this
      ->randomName($number, $prefix) . '@' . $domain);
  } while (in_array($mail, $this->mailadress_cache));
  $this->mailadress_cache[] = $mail;
  return $mail;
}