function LocalTaskDefaultTest::testCacheabilityMetadata

Same name in other branches
  1. 8.9.x 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()
  3. 11.x 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 330

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

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