TestCacheableDependency.php 691 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace Drupal\Tests\Core\Render;
  3. use Drupal\Core\Cache\CacheableDependencyInterface;
  4. /**
  5. * Cacheable dependency object for use in tests.
  6. */
  7. class TestCacheableDependency implements CacheableDependencyInterface {
  8. public function __construct(array $contexts, array $tags, $max_age) {
  9. $this->contexts = $contexts;
  10. $this->tags = $tags;
  11. $this->maxAge = $max_age;
  12. }
  13. /**
  14. * {@inheritdoc}
  15. */
  16. public function getCacheContexts() {
  17. return $this->contexts;
  18. }
  19. /**
  20. * {@inheritdoc}
  21. */
  22. public function getCacheTags() {
  23. return $this->tags;
  24. }
  25. /**
  26. * {@inheritdoc}
  27. */
  28. public function getCacheMaxAge() {
  29. return $this->maxAge;
  30. }
  31. }