You are here

function SimplenewsTestCase::setAuthenticatedUserSubscription in Simplenews 7

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

Set authenticated user permission to subscribe.

Parameters

boolean $enabled: Allow authenticated subscribing.

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

File

tests/simplenews.test, line 52
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();
  }
}