Commit 809854e0 authored by alexpott's avatar alexpott

Issue #2449069 by Berdir: Remove default block_plugin cache tags, because they're useless

parent 1506a99f
......@@ -370,10 +370,7 @@ public function getCacheContexts() {
* {@inheritdoc}
*/
public function getCacheTags() {
// If a block plugin's output changes, then it must be able to invalidate a
// cache tag that affects all instances of this block: across themes and
// across regions.
return array('block_plugin:' . str_replace(':', '__', $this->getPluginID()));
return [];
}
/**
......
......@@ -58,7 +58,6 @@ public function testBlockLinks() {
$this->assert(isset($links[0]), format_string('Link to href %href found.', array('%href' => $href)));
$cache_tags_header = $this->drupalGetHeader('X-Drupal-Cache-Tags');
$cache_tags = explode(' ', $cache_tags_header);
$this->assertTrue(in_array('block_plugin:aggregator_feed_block', $cache_tags));
$this->assertTrue(in_array('aggregator_feed:' . $feed->id(), $cache_tags));
// Visit that page.
......
......@@ -330,7 +330,6 @@ public function testBlockCacheTags() {
'config:block_list',
'block_view',
'config:block.block.powered',
'block_plugin:system_powered_by_block',
'rendered',
);
sort($expected_cache_tags);
......@@ -339,7 +338,6 @@ public function testBlockCacheTags() {
$expected_cache_tags = array(
'block_view',
'config:block.block.powered',
'block_plugin:system_powered_by_block',
'rendered',
);
sort($expected_cache_tags);
......@@ -371,7 +369,6 @@ public function testBlockCacheTags() {
'block_view',
'config:block.block.powered',
'config:block.block.powered-2',
'block_plugin:system_powered_by_block',
'rendered',
);
sort($expected_cache_tags);
......@@ -379,7 +376,6 @@ public function testBlockCacheTags() {
$expected_cache_tags = array(
'block_view',
'config:block.block.powered',
'block_plugin:system_powered_by_block',
'rendered',
);
sort($expected_cache_tags);
......@@ -388,19 +384,12 @@ public function testBlockCacheTags() {
$expected_cache_tags = array(
'block_view',
'config:block.block.powered-2',
'block_plugin:system_powered_by_block',
'rendered',
);
sort($expected_cache_tags);
$cache_entry = \Drupal::cache('render')->get('entity_view:block:powered-2:en:classy');
$this->assertIdentical($cache_entry->tags, $expected_cache_tags);
// The plugin providing the "Powered by Drupal" block is modified; verify a
// cache miss.
Cache::invalidateTags(array('block_plugin:system_powered_by_block'));
$this->drupalGet('<front>');
$this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS');
// Now we should have a cache hit again.
$this->drupalGet('<front>');
$this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT');
......
......@@ -215,7 +215,7 @@ public function testBlockViewBuilderAlter() {
$request->setMethod('GET');
$default_keys = array('entity_view', 'block', 'test_block');
$default_tags = array('block_view', 'config:block.block.test_block', 'block_plugin:test_cache');
$default_tags = array('block_view', 'config:block.block.test_block');
// Advanced: cached block, but an alter hook adds an additional cache key.
$this->setBlockCacheConfig(array(
......
......@@ -53,7 +53,6 @@ public function testMenuBlock() {
'block_view',
'config:block_list',
'config:block.block.' . $block->id(),
'block_plugin:system_menu_block__llama',
'config:system.menu.llama',
);
$this->verifyPageCache($url, 'HIT', $expected_tags);
......
......@@ -94,14 +94,6 @@ function testPageCacheTags() {
'config:block.block.bartik_powered',
'config:block.block.bartik_main_menu',
'config:block.block.bartik_account_menu',
'block_plugin:system_breadcrumb_block',
'block_plugin:system_main_block',
'block_plugin:system_menu_block__account',
'block_plugin:system_menu_block__main',
'block_plugin:system_menu_block__tools',
'block_plugin:user_login_block',
'block_plugin:system_menu_block__footer',
'block_plugin:system_powered_by_block',
'node_view',
'node:' . $node_1->id(),
'user:' . $author_1->id(),
......@@ -127,15 +119,6 @@ function testPageCacheTags() {
'config:block.block.bartik_powered',
'config:block.block.bartik_main_menu',
'config:block.block.bartik_account_menu',
'block_plugin:system_breadcrumb_block',
'block_plugin:system_main_block',
'block_plugin:system_menu_block__account',
'block_plugin:system_menu_block__main',
'block_plugin:system_menu_block__tools',
'block_plugin:user_login_block',
'block_plugin:views_block__comments_recent-block_1',
'block_plugin:system_menu_block__footer',
'block_plugin:system_powered_by_block',
'node_view',
'node:' . $node_2->id(),
'user:' . $author_2->id(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment