public function testTagCaching() { /** @var \Drupal\Core\Render\RendererInterface $renderer */
$renderer = \Drupal::
service('renderer'
);
$view = Views::
getView('test_tag_cache'
);
$build =
$view->
buildRenderable();
$renderer->
renderPlain($build);
// Saving the view should invalidate the tags.
$cache_plugin =
$view->display_handler->
getPlugin('cache'
);
$this->
assertTrue($cache_plugin->
cacheGet('results'
), 'Results cache found.'
);
$this->
assertNotEmpty($this->
getRenderCache($view), 'Output cache found.'
);
$view->storage->
save();
$this->
assertFalse($cache_plugin->
cacheGet('results'
), 'Results cache empty after the view is saved.'
);
$this->
assertFalse($this->
getRenderCache($view), 'Output cache empty after the view is saved.'
);
$view->
destroy();
$build =
$view->
buildRenderable();
$renderer->
renderPlain($build);
// Test invalidating the nodes in this view invalidates the cache.