public function AuthcacheViewsTest::testAdminListWithViewsUI 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 172 - Test cases for the Authcache Views module.
Class
- AuthcacheViewsTest
- Tests for markup substitution.
Code
public function testAdminListWithViewsUI() {
module_enable(array(
'views_ui',
));
$this
->resetAll();
$su = $this
->drupalCreateUser(array(
'administer site configuration',
'administer views',
));
$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
->assertText('Views', 'Views Group on the views page');
$this
->assertLink('views administration page', 0, 'Link with the label views administration page should be on the page');
$this
->assertLinkByHref('admin/structure/views', 0, '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.
$view = views_get_view('tracker');
$view->disabled = FALSE;
$view->display['page']->display_options['path'] = 'test-tracker';
views_save_view($view);
ctools_export_load_object_reset();
// Enable authcache on the page display.
$edit = array(
'authcache[status]' => '1',
);
$this
->drupalPost('admin/structure/views/nojs/display/tracker/page/authcache', $edit, t('Apply'));
$this
->drupalPost(NULL, array(), t('Save'));
// 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
->assertLink('views administration page', 0, 'A link with the label views administration page should be on the page');
$this
->assertLinkByHref('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
->assertLink('Edit', 0, 'An edit link should be on the page');
$this
->assertLinkByHref('admin/structure/views/view/' . $view->name . '/edit/page', 0, 'The edit link should point to the views display configuration form');
}