diff --git a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php index f717ec6..3245bd2 100644 --- a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php @@ -2311,7 +2311,7 @@ public function calculateCacheMetadata () { */ public function getCacheMetadata() { if (!isset($this->display['cache_metadata'])) { - $this->display['cache_metadata'] = $this->calculateCacheMetadata(); + list($this->display['cache_metadata']['cacheable'], $this->display['cache_metadata']['contexts']) = $this->calculateCacheMetadata(); } return $this->display['cache_metadata']; } diff --git a/core/modules/views/src/Tests/RenderCacheIntegrationTest.php b/core/modules/views/src/Tests/RenderCacheIntegrationTest.php index d498ac3..b1235b1 100644 --- a/core/modules/views/src/Tests/RenderCacheIntegrationTest.php +++ b/core/modules/views/src/Tests/RenderCacheIntegrationTest.php @@ -47,6 +47,12 @@ protected function setUp() { * Tests a field-based view's cache tags when using the "none" cache plugin. */ public function testFieldBasedViewCacheTagsWithCachePluginNone() { + $view = Views::getview('entity_test_fields'); + $view->getDisplay()->overrideOption('cache', [ + 'type' => 'none', + ]); + $view->save(); + $this->assertCacheTagsForFieldBasedView(FALSE); } @@ -192,6 +198,12 @@ protected function assertCacheTagsForFieldBasedView($do_assert_views_caches) { * Tests a entity-based view's cache tags when using the "none" cache plugin. */ public function testEntityBasedViewCacheTagsWithCachePluginNone() { + $view = Views::getview('entity_test_row'); + $view->getDisplay()->overrideOption('cache', [ + 'type' => 'none', + ]); + $view->save(); + $this->assertCacheTagsForEntityBasedView(FALSE); } diff --git a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php index 20bf579..173e857 100644 --- a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php +++ b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php @@ -10,6 +10,7 @@ use Drupal\Core\Form\FormStateInterface; use Drupal\views\Plugin\views\query\QueryPluginBase; use Drupal\views\Plugin\views\join\JoinPluginBase; +use Drupal\views\ResultRow; use Drupal\views\ViewExecutable; /** @@ -114,7 +115,7 @@ public function execute(ViewExecutable $view) { if ($this->fields) { $element = array_intersect_key($element, $this->fields); } - $result[] = (object) $element; + $result[] = new ResultRow($element); } } $this->view->result = $result;