You are here

class TestCacheableDependency in Drupal 8

Same name and namespace in other branches
  1. 9 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 10

Namespace

Drupal\Tests\Core\Render
View source
class TestCacheableDependency implements CacheableDependencyInterface {
  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

Namesort descending Modifiers Type Description Overrides
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