class TestCacheableDependency

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Render/TestCacheableDependency.php \Drupal\Tests\Core\Render\TestCacheableDependency
  2. 8.9.x core/tests/Drupal/Tests/Core/Render/TestCacheableDependency.php \Drupal\Tests\Core\Render\TestCacheableDependency
  3. 11.x core/tests/Drupal/Tests/Core/Render/TestCacheableDependency.php \Drupal\Tests\Core\Render\TestCacheableDependency

Cacheable dependency object for use in tests.

Hierarchy

Expanded class hierarchy of TestCacheableDependency

1 file declares its use of TestCacheableDependency
CacheableMetadataTest.php in core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php

File

core/tests/Drupal/Tests/Core/Render/TestCacheableDependency.php, line 12

Namespace

Drupal\Tests\Core\Render
View source
class TestCacheableDependency implements CacheableDependencyInterface {
    protected array $contexts;
    protected array $tags;
    protected $maxAge;
    public function __construct(array $contexts, array $tags, $max_age) {
        $this->contexts = $contexts;
        $this->tags = $tags;
        $this->maxAge = $max_age;
    }
    
    /**
     * {@inheritdoc}
     */
    public function getCacheContexts() {
        return $this->contexts;
    }
    
    /**
     * {@inheritdoc}
     */
    public function getCacheTags() {
        return $this->tags;
    }
    
    /**
     * {@inheritdoc}
     */
    public function getCacheMaxAge() {
        return $this->maxAge;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
TestCacheableDependency::$contexts protected property
TestCacheableDependency::$maxAge protected property
TestCacheableDependency::$tags protected property
TestCacheableDependency::getCacheContexts public function The cache contexts associated with this object. Overrides CacheableDependencyInterface::getCacheContexts
TestCacheableDependency::getCacheMaxAge public function The maximum age for which this object may be cached. Overrides CacheableDependencyInterface::getCacheMaxAge
TestCacheableDependency::getCacheTags public function The cache tags associated with this object. Overrides CacheableDependencyInterface::getCacheTags
TestCacheableDependency::__construct public function

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