You are here

public function AuthcacheBlockTest::testFailingMarkupSubstitutionCancelFallback in Authenticated User Page Caching (Authcache) 7.2

Ensure that markup is substituted for authcache enabled blocks.

File

modules/authcache_block/authcache_block.test, line 200
Test cases for the Authcache Block module.

Class

AuthcacheBlockTest
Tests for markup substitution.

Code

public function testFailingMarkupSubstitutionCancelFallback() {
  $region = 'sidebar_first';
  $admin = $this
    ->drupalCreateUser(array(
    'administer blocks',
    'configure authcache blocks',
  ));
  $this
    ->drupalLogin($admin);
  $block = block_load('block', $this
    ->createCustomBlock());
  $this
    ->moveBlockToRegion($block, $region);
  $edit = array(
    'authcache_settings[status]' => TRUE,
    'authcache_settings[fallback]' => 'cancel',
  );
  $this
    ->drupalPost('admin/structure/block/manage/' . $block->module . '/' . $block->delta . '/configure', $edit, t('Save block'));

  // Assert that config has no impact when user is not in authcache roles.
  $this
    ->drupalGet('node');
  $this
    ->assertBlockOnPage($block, $region);
  $this
    ->drupalLogout();

  // Assert that block is still on page however page was not saved to cache.
  $this
    ->drupalGet('node');
  $this
    ->assertBlockOnPage($block, $region);
}