/** * {@inheritdoc} */ public function getCacheTags() { // @todo https://www.drupal.org/node/2779933 write a test for this. $tags = parent::getCacheTags(); // Tab changes if node or node-type is modified. $tags = array_merge($tags, $this->entity->getCacheTags()); $tags[] = $this->entity->getEntityType()->getBundleEntityType() . ':' . $this->entity->bundle(); return $tags; }
/** * @covers ::getCacheContexts * @covers ::getCacheTags * @covers ::getCacheMaxAge */ public function testCacheabilityMetadata() { $this->pluginDefinition['cache_contexts'] = ['route']; $this->pluginDefinition['cache_tags'] = ['kitten']; $this->pluginDefinition['cache_max_age'] = 3600; $this->setupLocalTaskDefault(); $this->assertEquals(['route'], $this->localTaskBase->getCacheContexts()); $this->assertEquals(['kitten'], $this->localTaskBase->getCacheTags()); $this->assertEquals(3600, $this->localTaskBase->getCacheMaxAge()); }