You are here

public function LocalTaskDefaultTest::testCacheabilityMetadata in Drupal 9

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

@covers ::getCacheContexts @covers ::getCacheTags @covers ::getCacheMaxAge

File

core/tests/Drupal/Tests/Core/Menu/LocalTaskDefaultTest.php, line 327
Contains \Drupal\Tests\Core\Menu\LocalTaskDefaultTest.

Class

LocalTaskDefaultTest
@coversDefaultClass \Drupal\Core\Menu\LocalTaskDefault @group Menu

Namespace

Drupal\Tests\Core\Menu

Code

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());
}