You are here

function SimplenewsTestCase::setAuthenticatedUserSubscription in Simplenews 7.2

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

Set authenticated user permission to subscribe.

Parameters

boolean $enabled: Allow authenticated subscribing.

1 call to SimplenewsTestCase::setAuthenticatedUserSubscription()
SimpleNewsAdministrationTestCase::testNewsletterSettings in tests/simplenews.test
Test various combinations of newsletter settings.

File

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

Class

SimplenewsTestCase
@file Simplenews test functions.

Code

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