You are here

protected function WebTestBase::assertNoCacheContext in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/simpletest/src/WebTestBase.php \Drupal\simpletest\WebTestBase::assertNoCacheContext()

Asserts that a cache context was not present in the last response.

Parameters

string $not_expected_cache_context: The expected cache context.

1 call to WebTestBase::assertNoCacheContext()
NodeAccessAutoBubblingTest::testNodeAccessCacheabilitySafeguard in core/modules/node/src/Tests/NodeAccessAutoBubblingTest.php
Tests that the node grants cache context is auto-added, only when needed.

File

core/modules/simpletest/src/WebTestBase.php, line 3010
Contains \Drupal\simpletest\WebTestBase.

Class

WebTestBase
Test case for typical Drupal tests.

Namespace

Drupal\simpletest

Code

protected function assertNoCacheContext($not_expected_cache_context) {
  $cache_contexts = explode(' ', $this
    ->drupalGetHeader('X-Drupal-Cache-Contexts'));
  $this
    ->assertFalse(in_array($not_expected_cache_context, $cache_contexts), "'" . $not_expected_cache_context . "' is not present in the X-Drupal-Cache-Contexts header.");
}