diff --git a/core/modules/comment/lib/Drupal/comment/CommentFormController.php b/core/modules/comment/lib/Drupal/comment/CommentFormController.php index f0c38ad..816234c 100644 --- a/core/modules/comment/lib/Drupal/comment/CommentFormController.php +++ b/core/modules/comment/lib/Drupal/comment/CommentFormController.php @@ -411,6 +411,6 @@ public function save(array $form, array &$form_state) { // Clear the block and page caches so that anonymous users see the comment // they have posted. Cache::invalidateTags(array('content' => TRUE)); - $this->entityManager->getViewBuilder($entity->entityType())->resetCache(array($entity->id())); + $this->entityManager->getViewBuilder($entity->entityType())->resetCache(array($entity)); } } diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/CacheTagTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/CacheTagTest.php index 4f79f53..038e71d 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Plugin/CacheTagTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/CacheTagTest.php @@ -30,6 +30,27 @@ class CacheTagTest extends PluginTestBase { */ public static $modules = array('node'); + /** + * The node storage controller. + * + * @var \Drupal\node\NodeStorageController + */ + protected $nodeStorageController; + + /** + * The node view builder. + * + * @var \Drupal\node\NodeViewBuilder + */ + protected $nodeViewBuilder; + + /** + * The user view builder. + * + * @var \Drupal\Core\Entity\EntityViewBuilder + */ + protected $userViewBuilder; + public static function getInfo() { return array( 'name' => 'Cache tag', @@ -45,8 +66,8 @@ protected function setUp() { $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article')); $this->nodeStorageController = $this->container->get('entity.manager')->getStorageController('node'); - $this->nodeRenderController = $this->container->get('entity.manager')->getRenderController('node'); - $this->userRenderController = $this->container->get('entity.manager')->getRenderController('user'); + $this->nodeViewBuilder = $this->container->get('entity.manager')->getViewBuilder('node'); + $this->userViewBuilder = $this->container->get('entity.manager')->getViewBuilder('user'); for ($i = 1; $i <= 5; $i++) { $node = $this->nodeStorageController->create(array('title' => "Test $i", 'type' => 'page')); @@ -82,7 +103,7 @@ public function testTagCaching() { $this->assertTrue($cache_plugin->cacheGet('results')); $this->assertTrue($cache_plugin->cacheGet('output')); - $this->nodeRenderController->resetCache($this->pages); + $this->nodeViewBuilder->resetCache($this->pages); $this->assertFalse($cache_plugin->cacheGet('results')); $this->assertFalse($cache_plugin->cacheGet('output')); @@ -109,7 +130,7 @@ public function testTagCaching() { $this->assertTrue($cache_plugin->cacheGet('output')); // Test that invalidating a tag for a user, does not invalidate the cache. - $this->userRenderController->resetCache(array($this->user)); + $this->userViewBuilder->resetCache(array($this->user)); $cache_plugin = $view->display_handler->getPlugin('cache'); $this->assertTrue($cache_plugin->cacheGet('results'));