예제 #1
0
 /**
  * {@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;
 }
예제 #2
0
 /**
  * @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());
 }