You are here

public function AuthcacheViewsTest::testAdminListWithoutViewsUI in Authenticated User Page Caching (Authcache) 7.2

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

File

modules/authcache_views/authcache_views.test, line 124
Test cases for the Authcache Views module.

Class

AuthcacheViewsTest
Tests for markup substitution.

Code

public function testAdminListWithoutViewsUI() {
  $su = $this
    ->drupalCreateUser(array(
    'administer site configuration',
  ));
  $this
    ->drupalLogin($su);

  // Before any view is enabled, nothing should be visible on the list of
  // personalized fragments.
  $this
    ->drupalGet('admin/config/system/authcache/p13n');
  $this
    ->assertNoText('Views', 'No Views Group on the views page');
  $this
    ->assertNoLink('views administration page', 0, 'No link with the label views administration page should be on the page');
  $this
    ->assertNoLinkByHref('admin/structure/views', 0, 'No link to admin/structure/views should be on the page');
  $this
    ->assertNoLink('Edit', 0, 'No edit link should be on the page');

  // Enable the tracker view and configure authcache on the page-display.
  $view = views_get_view('tracker');
  $view->disabled = FALSE;
  $view->display['page']->display_options['authcache'] = array(
    'status' => '1',
    'lifespan' => '3600',
    'peruser' => '1',
    'perpage' => '1',
    'clients' => array(
      'authcache_p13n_test' => array(
        'status' => '1',
        'weight' => '0',
      ),
    ),
    'fallback' => 'cancel',
  );
  $view->display['page']->display_options['path'] = 'test-tracker';
  views_save_view($view);
  ctools_export_load_object_reset();

  // Verify that the tracker view is shown in the list of personalized
  // fragments.
  $this
    ->drupalGet('admin/config/system/authcache/p13n');
  $this
    ->assertText('Views', 'A group with the name Views should be on the page');
  $this
    ->assertNoLink('views administration page', 0, 'A link with the label views administration page should be on the page');
  $this
    ->assertNoLinkByHref('admin/structure/views', 0, 'A link to admin/structure/views should be on the page');
  $this
    ->assertText($view->human_name, 'The views human name should be on the page');
  $this
    ->assertNoLink('Edit', 0, 'No edit link should be on the page when Views UI is not enabled');
}