class TestCacheableDependency

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

Namespace

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

}

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