You are here

public function AuthcacheTestAdminWidgets::testRoleRestrictWidgetDefaultValue in Authenticated User Page Caching (Authcache) 7.2

Test role restrict widget with default value.

File

tests/authcache.widget.test, line 301
Test cases for pluggable cache backends.

Class

AuthcacheTestAdminWidgets
Cover authcache module.

Code

public function testRoleRestrictWidgetDefaultValue() {
  $form = system_settings_form(array(
    'authcache_widget_test_roles' => array(
      '#title' => $this
        ->randomName(8),
      '#type' => 'authcache_role_restrict',
      '#default_value' => array(
        'custom' => 1,
        'roles' => array(
          DRUPAL_AUTHENTICATED_RID => DRUPAL_AUTHENTICATED_RID,
        ),
      ),
    ),
  ));
  $form_stub = $this->stubmod
    ->hook('form', $form);
  $this
    ->drupalGet('authcache-widget-test-form');
  $this
    ->assertStub($form_stub, HookStub::once());
  $this
    ->assertNoText('Currently there are no roles enabled for authcache');
  $this
    ->assertNoLink('authcache settings');
  $this
    ->assertFieldChecked('edit-authcache-widget-test-roles-custom');
  $this
    ->assertFieldChecked('edit-authcache-widget-test-roles-roles-' . DRUPAL_AUTHENTICATED_RID);
}