diff --git a/core/modules/views/src/Tests/Plugin/DisplayPageWebTest.php b/core/modules/views/src/Tests/Plugin/DisplayPageWebTest.php index 2da04f3..4f7cb3b 100644 --- a/core/modules/views/src/Tests/Plugin/DisplayPageWebTest.php +++ b/core/modules/views/src/Tests/Plugin/DisplayPageWebTest.php @@ -21,7 +21,7 @@ class DisplayPageWebTest extends PluginTestBase { * * @var array */ - public static $testViews = array('test_page_display', 'test_page_display_arguments', 'test_page_display_menu'); + public static $testViews = array('test_page_display', 'test_page_display_arguments', 'test_page_display_menu', 'test_page_display_path'); /** * Modules to enable. @@ -134,4 +134,25 @@ public function testTitleOutput() { $this->assertFalse($xpath, 'The view title was not displayed in the view markup.'); } + /** + * Tests the views page path functionality. + */ + public function testPagePaths() { + $this->assertPagePath('0'); + $this->assertPagePath('9999'); + } + + /** + * Tests that we can successfully change a view page display path. + */ + public function assertPagePath($path) { + $view = Views::getView('test_page_display_path'); + $view->initDisplay('page_1'); + $view->displayHandlers->get('page_1')->overrideOption('path', $path); + $view->save(); + $this->container->get('router.builder')->rebuild(); + $this->drupalGet($path); + return $this->assertResponse(200); + } + } diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_page_display_path.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_page_display_path.yml new file mode 100644 index 0000000..c0530c4 --- /dev/null +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_page_display_path.yml @@ -0,0 +1,36 @@ +langcode: en +status: true +dependencies: { } +id: test_page_display_path +label: '' +module: views +description: '' +tag: '' +base_table: views_test_data +base_field: nid +core: '8' +display: + default: + display_options: + title: 'Test page display path' + defaults: + fields: false + pager: false + sorts: false + fields: + age: + field: age + id: age + relationship: none + table: views_test_data + plugin_id: numeric + display_plugin: default + display_title: Master + id: default + position: 0 + page_1: + display_options: + path: test_page_display_path + display_plugin: page + display_title: Page + id: page_1