diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentAnonymousTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentAnonymousTest.php
index 86f778a..b983cc7 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentAnonymousTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentAnonymousTest.php
@@ -146,6 +146,8 @@ function testAnonymous() {
'post comments' => FALSE,
'skip comment approval' => FALSE,
));
+ \Drupal::entityManager()->getRenderController('node')->resetCache();
+ \Drupal::entityManager()->getRenderController('comment')->resetCache();
$this->drupalGet('node/' . $this->node->nid);
$this->assertPattern('@
]*>Comments
@', 'Comments were displayed.');
$this->assertLink('Log in', 1, 'Link to log in was found.');
@@ -156,6 +158,8 @@ function testAnonymous() {
'post comments' => TRUE,
'skip comment approval' => TRUE,
));
+ \Drupal::entityManager()->getRenderController('node')->resetCache();
+ \Drupal::entityManager()->getRenderController('comment')->resetCache();
$this->drupalGet('node/' . $this->node->nid);
$this->assertNoPattern('@]*>Comments
@', 'Comments were not displayed.');
$this->assertFieldByName('subject', '', 'Subject field found.');
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php
index 5585650..7f74c3e 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php
@@ -207,6 +207,9 @@ function setEnvironment(array $info) {
// Update current environment.
$current = $info;
+ // Clear the render cache.
+ entity_render_cache_clear();
+
return $info;
}
diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageDisplayTest.php b/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageDisplayTest.php
index 51dc8b1..1518ca1 100644
--- a/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageDisplayTest.php
+++ b/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageDisplayTest.php
@@ -280,7 +280,7 @@ function assertNodeViewTextHelper(EntityInterface $node, $view_mode, $text, $mes
// Render a cloned node, so that we do not alter the original.
$clone = clone $node;
- $element = node_view($clone, $view_mode);
+ $element = entity_view($clone, $view_mode, NULL, TRUE);
$output = drupal_render($element);
$this->verbose(t('Rendered node - view mode: @view_mode', array('@view_mode' => $view_mode)) . '
'. $output);
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php b/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php
index 1cd12bc..3a84f48 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php
@@ -120,6 +120,8 @@ function testPictureOnNodeComment() {
->set('features.node_user_picture', FALSE)
->set('features.comment_user_picture', FALSE)
->save();
+ \Drupal::entityManager()->getStorageController('node')->resetCache(array($node));
+ \Drupal::entityManager()->getStorageController('comment')->resetCache();
$this->drupalGet('node/' . $node->nid);
$this->assertNoRaw(file_uri_target($file->uri), 'User picture not found on node and comment.');
diff --git a/core/modules/user/user.admin.inc b/core/modules/user/user.admin.inc
index 9946ae2..12347fd 100644
--- a/core/modules/user/user.admin.inc
+++ b/core/modules/user/user.admin.inc
@@ -383,8 +383,9 @@ function user_admin_permissions_submit($form, &$form_state) {
drupal_set_message(t('The changes have been saved.'));
- // Clear the cached pages and blocks.
+ // Clear cached pages, blocks and rendered entities.
cache_invalidate_tags(array('content' => TRUE));
+ entity_render_cache_clear();
}
/**
diff --git a/core/modules/user/user.module b/core/modules/user/user.module
index 7e316c8..322311f 100644
--- a/core/modules/user/user.module
+++ b/core/modules/user/user.module
@@ -1963,8 +1963,6 @@ function user_role_grant_permissions($rid, array $permissions = array()) {
// Clear the user access cache.
drupal_static_reset('user_access');
drupal_static_reset('user_role_permissions');
- // Entity render cache is based on user roles, so we need to clear it as well.
- entity_render_cache_clear();
}
/**
@@ -1988,8 +1986,6 @@ function user_role_revoke_permissions($rid, array $permissions = array()) {
// Clear the user access cache.
drupal_static_reset('user_access');
drupal_static_reset('user_role_permissions');
- // Entity render cache is based on user roles, so we need to clear it as well.
- entity_render_cache_clear();
}
/**