You are here

public function AuthcacheFieldTest::testAdminList in Authenticated User Page Caching (Authcache) 7.2

Ensure that a field shows up in the list of personalized elements.

File

modules/authcache_field/authcache_field.test, line 139
Test cases for the Authcache Field module.

Class

AuthcacheFieldTest
Tests for markup substitution.

Code

public function testAdminList() {
  $required_perms = array(
    'administer site configuration',
    'administer content types',
  );

  // The permission 'administer fields' is not available in all versions of
  // Drupal 7. See https://www.drupal.org/node/611294
  $available_perms = user_permission_get_modules();
  if (isset($available_perms['administer fields'])) {
    $required_perms[] = 'administer fields';
  }
  $su = $this
    ->drupalCreateUser($required_perms);
  $this
    ->drupalLogin($su);
  $this
    ->drupalGet('admin/config/system/authcache/p13n');
  $this
    ->assertText('Fields', 'A group with the name Fields should be on the page');
  $this
    ->assertText('Body', 'The field title should be on the page');
  $this
    ->assertLink('Edit', 0, 'An edit link should be on the page');
  $this
    ->assertLinkByHref('admin/structure/types/manage/article/fields/body', 0, 'The edit link should point to the fields configuration form');

  // Check whether checkbox is enabled on field settings.
  $this
    ->clickLink('Edit');
  $this
    ->assertFieldChecked('edit-instance-settings-authcache-status', 'Authcache checkbox is checked on field settings');
}