You are here

public function JuiceboxViewsCase::testViewsAdvanced in Juicebox HTML5 Responsive Image Galleries 7.2

Test using pre-packaged advanced Juicebox view.

The view tested here is largely the same as the "base" one tested above but it includes tight access restrictions and caching.

File

tests/JuiceboxViewsCase.test, line 83
Test case for integration with File Entity module.

Class

JuiceboxViewsCase
Class to define test case for integration with File Entity module.

Code

public function testViewsAdvanced() {

  // Request the view page. This will prime the views cache.
  $this
    ->drupalGet('juicebox-views-advanced-test');
  $this
    ->assertRaw('id="viewsstyle--juicebox-views-test--page-1"', 'Embed code wrapper found.');

  // Now request the XML. This will trigger a cached view so we can test that
  // the special allocations for views caching kick-in.
  $this
    ->drupalGet('juicebox/xml/viewsstyle/juicebox_views_test/page_1');
  $this
    ->assertRaw('<?xml version="1.0" encoding="UTF-8"?>', 'Valid XML detected on cached view.');

  // Logout and test that XML access is restricted. Note that this test view
  // is setup to limit view access only to admins.
  $this
    ->drupalLogout();
  $this
    ->drupalGet('juicebox/xml/viewsstyle/juicebox_views_test/page_1');
  $this
    ->assertResponse(403, 'XML access blocked for access-restricted view.');
}