protected function WebTestBase::assertCacheContext in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/simpletest/src/WebTestBase.php \Drupal\simpletest\WebTestBase::assertCacheContext()
Asserts whether an expected cache context was present in the last response.
Parameters
string $expected_cache_context: The expected cache context.
16 calls to WebTestBase::assertCacheContext()
- AccessRoleTest::testAccessRole in core/
modules/ user/ src/ Tests/ Views/ AccessRoleTest.php - Tests role access plugin.
- CacheabilityMetadataConfigOverrideIntegrationTest::testConfigOverride in core/
modules/ config/ src/ Tests/ CacheabilityMetadataConfigOverrideIntegrationTest.php - Tests if config overrides correctly set cacheability metadata.
- ContactPersonalTest::testPersonalContactAccess in core/
modules/ contact/ src/ Tests/ ContactPersonalTest.php - Tests access to the personal contact form.
- ContentTranslationWorkflowsTest::testWorkflows in core/
modules/ content_translation/ src/ Tests/ ContentTranslationWorkflowsTest.php - Test simple and editorial translation workflows.
- DisplayPathTest::testMenuOptions in core/
modules/ views_ui/ src/ Tests/ DisplayPathTest.php - Tests the menu and tab option form.
File
- core/
modules/ simpletest/ src/ WebTestBase.php, line 2999 - Contains \Drupal\simpletest\WebTestBase.
Class
- WebTestBase
- Test case for typical Drupal tests.
Namespace
Drupal\simpletestCode
protected function assertCacheContext($expected_cache_context) {
$cache_contexts = explode(' ', $this
->drupalGetHeader('X-Drupal-Cache-Contexts'));
$this
->assertTrue(in_array($expected_cache_context, $cache_contexts), "'" . $expected_cache_context . "' is present in the X-Drupal-Cache-Contexts header.");
}