You are here

protected function SimplenewsTestBase::getRandomNewsletter in Simplenews 3.x

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/SimplenewsTestBase.php \Drupal\Tests\simplenews\Functional\SimplenewsTestBase::getRandomNewsletter()

Select randomly one of the available newsletters.

Return value

string The ID of a newsletter.

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

... See full list

File

tests/src/Functional/SimplenewsTestBase.php, line 82

Class

SimplenewsTestBase
Base class for simplenews web tests.

Namespace

Drupal\Tests\simplenews\Functional

Code

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