core/lib/Drupal/Core/Render/BubbleableMetadata.php | 13 ++++--------- .../system/src/Tests/Entity/EntityCacheTagsTestBase.php | 4 ---- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/core/lib/Drupal/Core/Render/BubbleableMetadata.php b/core/lib/Drupal/Core/Render/BubbleableMetadata.php index 90185b4..ccf11fd 100644 --- a/core/lib/Drupal/Core/Render/BubbleableMetadata.php +++ b/core/lib/Drupal/Core/Render/BubbleableMetadata.php @@ -109,7 +109,6 @@ public static function createFromRenderArray(array $build) { return $meta; } - /** * Creates a bubbleable metadata object from an access result. * @@ -123,13 +122,10 @@ public static function createFromAccessResult(AccessResultInterface $access_resu return static::createFromCacheableObject($access_result); } + // Any AccessResultInterface object that doesn't implement + // CacheableInterface must be assumed to be uncacheable. $meta = new static(); - - // @todo Any AccessResultInterface object that doesn't implement - // CacheableInterface must be assumed to be uncacheable. Hence we apply - // the 'uncacheable' cache context. But that isn't available until - // https://www.drupal.org/node/2443073 lands. - $meta->contexts = ['uncacheable']; + $meta->maxAge = 0; return $meta; } @@ -145,8 +141,7 @@ public static function createFromCacheableObject(CacheableInterface $object) { $meta = new static(); $meta->contexts = $object->getCacheContexts(); $meta->tags = $object->getCacheTags(); - // With a #cache['max-age'] property in the future: - //$meta->maxAge = $object->getCacheMaxAge(); + $meta->maxAge = $object->getCacheMaxAge(); return $meta; } diff --git a/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php b/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php index add6de5..9f2f7b8 100644 --- a/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php +++ b/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php @@ -389,8 +389,6 @@ public function testReferencedEntity() { $this->pass("Test empty listing.", 'Debug'); - // @todo verify ::getListCacheTags() are present, blocked on - // https://www.drupal.org/node/2445761 // Prime the page cache for the empty listing. $this->verifyPageCache($empty_entity_listing_url, 'MISS'); // Verify a cache hit, but also the presence of the correct cache tags. @@ -401,8 +399,6 @@ public function testReferencedEntity() { $this->pass("Test listing containing referenced entity.", 'Debug'); - // @todo verify ::getListCacheTags() are present, blocked on - // https://www.drupal.org/node/2445761 // Prime the page cache for the listing containing the referenced entity. $this->verifyPageCache($nonempty_entity_listing_url, 'MISS', $nonempty_entity_listing_cache_tags); // Verify a cache hit, but also the presence of the correct cache tags.