core/modules/node/src/Tests/NodeTypeTest.php | 1 + .../responsive_image/src/Tests/ResponsiveImageFieldDisplayTest.php | 3 +++ core/modules/simpletest/src/WebTestBase.php | 1 + core/modules/system/src/Tests/Routing/RouterTest.php | 2 ++ core/modules/views/src/Tests/RenderCacheIntegrationTest.php | 3 --- 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/core/modules/node/src/Tests/NodeTypeTest.php b/core/modules/node/src/Tests/NodeTypeTest.php index 2b26d83..039bc7e 100644 --- a/core/modules/node/src/Tests/NodeTypeTest.php +++ b/core/modules/node/src/Tests/NodeTypeTest.php @@ -48,6 +48,7 @@ function testNodeTypeGetFunctions() { * Tests creating a content type programmatically and via a form. */ function testNodeTypeCreation() { + $this->setCacheabilityHeaders(TRUE); // Create a content type programmatically. $type = $this->drupalCreateContentType(); diff --git a/core/modules/responsive_image/src/Tests/ResponsiveImageFieldDisplayTest.php b/core/modules/responsive_image/src/Tests/ResponsiveImageFieldDisplayTest.php index b42831b..9258f19 100644 --- a/core/modules/responsive_image/src/Tests/ResponsiveImageFieldDisplayTest.php +++ b/core/modules/responsive_image/src/Tests/ResponsiveImageFieldDisplayTest.php @@ -72,6 +72,7 @@ protected function setUp() { * Tests responsive image formatters on node display for public files. */ public function testResponsiveImageFieldFormattersPublic() { + $this->setCacheabilityHeaders(TRUE); $this->addTestImageStyleMappings(); $this->doTestResponsiveImageFieldFormatters('public'); } @@ -80,6 +81,7 @@ public function testResponsiveImageFieldFormattersPublic() { * Tests responsive image formatters on node display for private files. */ public function testResponsiveImageFieldFormattersPrivate() { + $this->setCacheabilityHeaders(TRUE); $this->addTestImageStyleMappings(); // Remove access content permission from anonymous users. user_role_change_permissions(RoleInterface::ANONYMOUS_ID, array('access content' => FALSE)); @@ -90,6 +92,7 @@ public function testResponsiveImageFieldFormattersPrivate() { * Test responsive image formatters when image style is empty. */ public function testResponsiveImageFieldFormattersEmptyStyle() { + $this->setCacheabilityHeaders(TRUE); $this->addTestImageStyleMappings(TRUE); $this->doTestResponsiveImageFieldFormatters('public', TRUE); } diff --git a/core/modules/simpletest/src/WebTestBase.php b/core/modules/simpletest/src/WebTestBase.php index 765c1b5..b65366d 100644 --- a/core/modules/simpletest/src/WebTestBase.php +++ b/core/modules/simpletest/src/WebTestBase.php @@ -3028,6 +3028,7 @@ protected function assertNoCacheTag($cache_tag) { protected function setCacheabilityHeaders($value = TRUE) { $this->setContainerParameter('http.cacheability_headers.send', $value); $this->rebuildContainer(); + $this->resetAll(); } } diff --git a/core/modules/system/src/Tests/Routing/RouterTest.php b/core/modules/system/src/Tests/Routing/RouterTest.php index 17345fa..1e1ac12 100644 --- a/core/modules/system/src/Tests/Routing/RouterTest.php +++ b/core/modules/system/src/Tests/Routing/RouterTest.php @@ -32,6 +32,8 @@ class RouterTest extends WebTestBase { * Confirms that our FinishResponseSubscriber logic works properly. */ public function testFinishResponseSubscriber() { + $this->setCacheabilityHeaders(); + $renderer_required_cache_contexts = ['languages:' . LanguageInterface::TYPE_INTERFACE, 'theme', 'user.permissions']; $expected_cache_contexts = Cache::mergeContexts($renderer_required_cache_contexts, ['url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT]); diff --git a/core/modules/views/src/Tests/RenderCacheIntegrationTest.php b/core/modules/views/src/Tests/RenderCacheIntegrationTest.php index 8bd1b3d..a5b7cad 100644 --- a/core/modules/views/src/Tests/RenderCacheIntegrationTest.php +++ b/core/modules/views/src/Tests/RenderCacheIntegrationTest.php @@ -39,9 +39,6 @@ class RenderCacheIntegrationTest extends ViewKernelTestBase { protected function setUp() { parent::setUp(); - $this->setCacheabilityHeaders(TRUE); - $this->rebuildContainer(); - $this->installEntitySchema('entity_test'); $this->installEntitySchema('user'); }