function LocalTaskDefaultTest::testCacheabilityMetadata

Same name and namespace in other branches
  1. 10 core/tests/Drupal/Tests/Core/Menu/LocalTaskDefaultTest.php \Drupal\Tests\Core\Menu\LocalTaskDefaultTest::testCacheabilityMetadata()
  2. 9 core/tests/Drupal/Tests/Core/Menu/LocalTaskDefaultTest.php \Drupal\Tests\Core\Menu\LocalTaskDefaultTest::testCacheabilityMetadata()
  3. 8.9.x core/tests/Drupal/Tests/Core/Menu/LocalTaskDefaultTest.php \Drupal\Tests\Core\Menu\LocalTaskDefaultTest::testCacheabilityMetadata()

Tests cacheability metadata.

@legacy-covers ::getCacheContexts @legacy-covers ::getCacheTags @legacy-covers ::getCacheMaxAge

File

core/tests/Drupal/Tests/Core/Menu/LocalTaskDefaultTest.php, line 352

Class

LocalTaskDefaultTest
Tests Drupal\Core\Menu\LocalTaskDefault.

Namespace

Drupal\Tests\Core\Menu

Code

public function testCacheabilityMetadata() : void {
  $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());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.