public function WebformBlockCacheTest::testAnonymousVisitIsCacheable in Webform 6.x
Same name and namespace in other branches
- 8.5 tests/src/Functional/WebformBlockCacheTest.php \Drupal\Tests\webform\Functional\WebformBlockCacheTest::testAnonymousVisitIsCacheable()
Test that an anonymous can visit the webform block and the page is cacheable.
File
- tests/
src/ Functional/ WebformBlockCacheTest.php, line 55
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\FunctionalCode
public function testAnonymousVisitIsCacheable() {
$this
->drupalGet('/node/1');
$this
->assertSession()
->responseContains('Contact');
$this
->assertEquals('MISS', $this
->drupalGetHeader('X-Drupal-Cache'));
$this
->drupalGet('/node/1');
$this
->assertEquals('HIT', $this
->drupalGetHeader('X-Drupal-Cache'));
}