.../comment/Tests/CommentDefaultFormatterCacheTagsTest.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentDefaultFormatterCacheTagsTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentDefaultFormatterCacheTagsTest.php index cdec3ec..5e66470 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentDefaultFormatterCacheTagsTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentDefaultFormatterCacheTagsTest.php @@ -39,6 +39,10 @@ public static function getInfo() { public function setUp() { parent::setUp(); + $this->drupalLogin($this->drupalCreateUser(array( + 'access comments', + ))); + // Set up a field, so that the entity that'll be referenced bubbles up a // cache tag when rendering it entirely. entity_create('field_config', array( @@ -95,6 +99,11 @@ public function testCacheTags() { )); $comment->save(); + // Load commented entity so comment_count gets computed. + // @todo remove the $reset = TRUE parameter after + // https://drupal.org/node/597236 lands, it's a temporary work-around. + $commented_entity = entity_load('entity_test', $commented_entity->id(), TRUE); + // Verify cache tags on the rendered entity before it has comments. $build = \Drupal::entityManager() ->getViewBuilder('entity_test')