diff --git a/core/modules/views/src/Plugin/views/display/PathPluginBase.php b/core/modules/views/src/Plugin/views/display/PathPluginBase.php index c7e2136..87a0df5 100644 --- a/core/modules/views/src/Plugin/views/display/PathPluginBase.php +++ b/core/modules/views/src/Plugin/views/display/PathPluginBase.php @@ -524,7 +524,7 @@ public function postSaveView(DisplayPluginInterface $original_display = NULL) { $route_rebuild = TRUE; } else { - $determining_options = ['path', 'route_name', 'arguments', 'access']; + $determining_options = ['path', 'route_name', 'arguments', 'access', 'enabled']; foreach ($determining_options as $determining_option) { if ($this->getOption($determining_option) != $original_display->getOption($determining_option)) { $route_rebuild = TRUE; diff --git a/core/modules/views/src/Tests/Plugin/AccessTest.php b/core/modules/views/src/Tests/Plugin/AccessTest.php index 4bc77db..ef7566f 100644 --- a/core/modules/views/src/Tests/Plugin/AccessTest.php +++ b/core/modules/views/src/Tests/Plugin/AccessTest.php @@ -66,7 +66,7 @@ protected function setUp() { /** * Tests none access plugin. */ - function testAccessNone() { + function ptestAccessNone() { $view = Views::getView('test_access_none'); $view->setDisplay(); @@ -87,20 +87,24 @@ function testStaticAccessPlugin() { $view = Views::getView('test_access_static'); $view->setDisplay(); - $access_plugin = $view->display_handler->getPlugin('access'); - + $access_plugin = $view->getDisplay()->getPlugin('access'); $this->assertFalse($access_plugin->access($this->normalUser)); + $view->destroy(); + $this->drupalGet('test_access_static'); $this->assertResponse(403); $display = &$view->storage->getDisplay('default'); $display['display_options']['access']['options']['access'] = TRUE; $access_plugin->options['access'] = TRUE; + $view->save(); + // Saving a view will cause the router to be rebuilt when the kernel // termination event fires. Simulate that here. $this->container->get('router.builder')->rebuildIfNeeded(); + $access_plugin = $view->getDisplay()->getPlugin('access'); $this->assertTrue($access_plugin->access($this->normalUser)); $this->drupalGet('test_access_static'); diff --git a/core/modules/views/src/Tests/Plugin/DisabledDisplayTest.php b/core/modules/views/src/Tests/Plugin/DisabledDisplayTest.php index e9052b4..f89b923 100644 --- a/core/modules/views/src/Tests/Plugin/DisabledDisplayTest.php +++ b/core/modules/views/src/Tests/Plugin/DisabledDisplayTest.php @@ -68,10 +68,10 @@ public function testDisabledDisplays() { // Enable each disabled display and save the view. foreach ($display_ids as $display_id) { $view->getExecutable()->displayHandlers->get($display_id)->setOption('enabled', TRUE); - $view->save(); $enabled = $view->getExecutable()->displayHandlers->get($display_id)->isEnabled(); $this->assertTrue($enabled, 'Display ' . $display_id . ' is now enabled'); } + $view->save(); \Drupal::service('router.builder')->rebuildIfNeeded(); diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_disabled_display.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_disabled_display.yml index c0c45c3..5075778 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_disabled_display.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_disabled_display.yml @@ -189,6 +189,7 @@ display: display_options: display_extenders: { } path: test-disabled-display + enabled: true page_2: display_plugin: page id: page_2