You are here

function SimplenewsTestBase::getRandomNewsletter in Simplenews 8

Select randomly one of the available newsletters.

Return value

string The ID of a newsletter.

11 calls to SimplenewsTestBase::getRandomNewsletter()
SimplenewsAdministrationTest::testContentTypes in src/Tests/SimplenewsAdministrationTest.php
Test content type configuration.
SimplenewsAdministrationTest::testSubscriptionManagement in src/Tests/SimplenewsAdministrationTest.php
Test newsletter subscription management.
SimplenewsI18nTest::testNewsletterIssueTranslation in src/Tests/SimplenewsI18nTest.php
SimplenewsSendTest::testHtmlEscaping in src/Tests/SimplenewsSendTest.php
Test the correct handlling of HTML special characters in plain text mails.
SimplenewsSendTest::testImpersonation in src/Tests/SimplenewsSendTest.php
Test that the correct user is used when sending newsletters.

... See full list

File

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

Class

SimplenewsTestBase
Base class for simplenews web tests.

Namespace

Drupal\simplenews\Tests

Code

function getRandomNewsletter() {
  if ($newsletters = array_keys(simplenews_newsletter_get_all())) {
    return $newsletters[array_rand($newsletters)];
  }
  return 0;
}