diff --git a/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php index 9431cea..96fbe76 100644 --- a/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php @@ -299,7 +299,8 @@ protected function setExpiresNoCache(Response $response) { */ public static function getSubscribedEvents() { $events[KernelEvents::RESPONSE][] = array('onRespond'); - $events[KernelEvents::RESPONSE][] = array('onAllResponds'); + // Execute before the onRespond method. + $events[KernelEvents::RESPONSE][] = array('onAllResponds', 16); return $events; } diff --git a/core/modules/block/src/Tests/Views/DisplayBlockTest.php b/core/modules/block/src/Tests/Views/DisplayBlockTest.php index 368af68..d878175 100644 --- a/core/modules/block/src/Tests/Views/DisplayBlockTest.php +++ b/core/modules/block/src/Tests/Views/DisplayBlockTest.php @@ -262,7 +262,7 @@ public function testBlockRendering() { $result = $this->xpath('//div[contains(@class, "region-sidebar-first")]/div[contains(@class, "block-views")]/h2'); $this->assertTrue(empty($result), 'The title is not visible.'); - $this->assertCacheTags(array_merge($block->getCacheTags(), ['block_view', 'config:block_list', 'config:system.site', 'config:views.view.test_view_block' , 'rendered'])); + $this->assertCacheTags(array_merge($block->getCacheTags(), ['block_view', 'config:block_list', 'config:system.site', 'config:views.view.test_view_block' , 'http_response', 'rendered'])); } /** @@ -288,7 +288,7 @@ public function testBlockEmptyRendering() { $this->assertEqual(0, count($this->xpath('//div[contains(@class, "block-views-blocktest-view-block-block-1")]'))); // Ensure that the view cachability metadata is propagated even, for an // empty block. - $this->assertCacheTags(array_merge($block->getCacheTags(), ['block_view', 'config:block_list', 'config:views.view.test_view_block' , 'rendered'])); + $this->assertCacheTags(array_merge($block->getCacheTags(), ['block_view', 'config:block_list', 'config:views.view.test_view_block' , 'http_response', 'rendered'])); $this->assertCacheContexts(['url.query_args:_wrapper_format']); // Add a header displayed on empty result. @@ -306,7 +306,7 @@ public function testBlockEmptyRendering() { $this->drupalGet($url); $this->assertEqual(1, count($this->xpath('//div[contains(@class, "block-views-blocktest-view-block-block-1")]'))); - $this->assertCacheTags(array_merge($block->getCacheTags(), ['block_view', 'config:block_list', 'config:views.view.test_view_block' , 'rendered'])); + $this->assertCacheTags(array_merge($block->getCacheTags(), ['block_view', 'config:block_list', 'config:views.view.test_view_block' , 'http_response', 'rendered'])); $this->assertCacheContexts(['url.query_args:_wrapper_format']); // Hide the header on empty results. @@ -324,7 +324,7 @@ public function testBlockEmptyRendering() { $this->drupalGet($url); $this->assertEqual(0, count($this->xpath('//div[contains(@class, "block-views-blocktest-view-block-block-1")]'))); - $this->assertCacheTags(array_merge($block->getCacheTags(), ['block_view', 'config:block_list', 'config:views.view.test_view_block' , 'rendered'])); + $this->assertCacheTags(array_merge($block->getCacheTags(), ['block_view', 'config:block_list', 'config:views.view.test_view_block', 'http_response', 'rendered'])); $this->assertCacheContexts(['url.query_args:_wrapper_format']); // Add an empty text. @@ -341,7 +341,7 @@ public function testBlockEmptyRendering() { $this->drupalGet($url); $this->assertEqual(1, count($this->xpath('//div[contains(@class, "block-views-blocktest-view-block-block-1")]'))); - $this->assertCacheTags(array_merge($block->getCacheTags(), ['block_view', 'config:block_list', 'config:views.view.test_view_block' , 'rendered'])); + $this->assertCacheTags(array_merge($block->getCacheTags(), ['block_view', 'config:block_list', 'config:views.view.test_view_block', 'http_response', 'rendered'])); $this->assertCacheContexts(['url.query_args:_wrapper_format']); } diff --git a/core/modules/system/src/Tests/Cache/AssertPageCacheContextsAndTagsTrait.php b/core/modules/system/src/Tests/Cache/AssertPageCacheContextsAndTagsTrait.php index 266ffbd..c216e9b 100644 --- a/core/modules/system/src/Tests/Cache/AssertPageCacheContextsAndTagsTrait.php +++ b/core/modules/system/src/Tests/Cache/AssertPageCacheContextsAndTagsTrait.php @@ -129,6 +129,7 @@ protected function assertCacheTags(array $expected_tags, $include_default_tags = $expected_tags[] = 'http_response'; } $actual_tags = $this->getCacheHeaderValues('X-Drupal-Cache-Tags'); + $expected_tags = array_unique($expected_tags); sort($expected_tags); sort($actual_tags); $this->assertIdentical($actual_tags, $expected_tags);