You are here

public function WebformBlockCacheTest::testAuthenticatedVisitIsCacheable in Webform 6.x

Same name and namespace in other branches
  1. 8.5 tests/src/Functional/WebformBlockCacheTest.php \Drupal\Tests\webform\Functional\WebformBlockCacheTest::testAuthenticatedVisitIsCacheable()

Test that admin user can visit the page and the it is cacheable.

File

tests/src/Functional/WebformBlockCacheTest.php, line 66

Class

WebformBlockCacheTest
These tests proof that the webform block which renders the webform as a block provides the correct cache tags / cache contexts so that cachability works.

Namespace

Drupal\Tests\webform\Functional

Code

public function testAuthenticatedVisitIsCacheable() {
  $this
    ->drupalLogin($this->authenticatedUser);
  $this
    ->drupalGet('/node/1');
  $this
    ->assertSession()
    ->responseContains('Contact');
  $this
    ->assertEquals('MISS', $this
    ->drupalGetHeader('X-Drupal-Dynamic-Cache'));
  $this
    ->drupalGet('/node/1');
  $this
    ->assertEquals('HIT', $this
    ->drupalGetHeader('X-Drupal-Dynamic-Cache'));
}