You are here

function SimplenewsTestCase::setAnonymousUserSubscription in Simplenews 7

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

Set anonymous user permission to subscribe.

Parameters

boolean $enabled: Allow anonymous subscribing.

4 calls to SimplenewsTestCase::setAnonymousUserSubscription()
SimplenewsSubscribeTestCase::testSubscribeAnonymous in tests/simplenews.test
testSubscribeAnonymous
SimplenewsSubscribeTestCase::testSubscribeAnonymousSingle in tests/simplenews.test
Test anonymous subscription with single opt in.
SimplenewsSubscribeTestCase::testSubscribeAuthenticated in tests/simplenews.test
testSubscribeAuthenticated
SimplenewsSubscribeTestCase::testSubscribeMultiple in tests/simplenews.test
Subscribe to multiple newsletters at the same time.

File

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

Class

SimplenewsTestCase
@file Simplenews test functions.

Code

function setAnonymousUserSubscription($enabled) {
  if ($enabled) {
    db_insert('role_permission')
      ->fields(array(
      'rid',
      'permission',
    ), array(
      DRUPAL_ANONYMOUS_RID,
      'subscribe to newsletters',
    ))
      ->execute();
  }
}