diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/display/PathPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/display/PathPluginBase.php index da11400..67380a9 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/display/PathPluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/display/PathPluginBase.php @@ -196,6 +196,7 @@ public function alterRoutes(RouteCollection $collection) { // Find all paths which match the path of the current display.. $route_path = RouteCompiler::getPathWithoutDefaults($route); $route_path = RouteCompiler::getPatternOutline($route_path); + print_r($view_path); if (!$route->hasDefault('view_id') && '/' . $view_path == $route_path) { // @todo Figure out whether we need to merge some settings (like // requirements). diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayPageTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayPageTest.php index 8e67417..66b5e8d 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayPageTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayPageTest.php @@ -84,7 +84,6 @@ public function testPageResponses() { $view = views_get_view('test_page_display'); // Disable the view, rebuild menu, and request the page again. $view->storage->disable()->save(); - $subrequest = Request::create('/test_page_display_200', 'GET'); $response = $this->container->get('http_kernel')->handle($subrequest, HttpKernelInterface::SUB_REQUEST); $this->assertEqual($response->getStatusCode(), 404); diff --git a/core/modules/views/tests/Drupal/views/Tests/Plugin/display/PathPluginBaseTest.php b/core/modules/views/tests/Drupal/views/Tests/Plugin/display/PathPluginBaseTest.php index c251c41..ab6af91 100644 --- a/core/modules/views/tests/Drupal/views/Tests/Plugin/display/PathPluginBaseTest.php +++ b/core/modules/views/tests/Drupal/views/Tests/Plugin/display/PathPluginBaseTest.php @@ -5,7 +5,7 @@ * Contains \Drupal\views\Tests\Plugin\display\PathPluginBaseTest. */ -namespace Drupal\views\Tests\Plugin\display; +namespace Drupal\views\Tests\Plugin\display { use Drupal\Tests\UnitTestCase; use Symfony\Component\Routing\Route; @@ -64,13 +64,31 @@ public function testAlterRoute() { $view = $this->getMockBuilder('Drupal\views\ViewExecutable') ->disableOriginalConstructor() ->getMock(); + // Skip views options caching. + $view->editing = TRUE; + $display = array(); $display['display_plugin'] = 'page'; $display['id'] = 'page_1'; $display['display_options'] = array( - + 'path' => 'test_route', ); - // @todo write the actual test. + $this->pathPlugin->initDisplay($view, $display); + + $this->pathPlugin->alterRoutes($collection); + + $this->assertNull($collection->get('test_route'), 'Route with same path as view got removed.'); + $this->assertInstanceOf('Symfony\Component\Routing\Route', $collection->get('test_route_2')); } } + +} + +namespace { + if (!function_exists('views_get_enabled_display_extenders')) { + function views_get_enabled_display_extenders() { + return array(); + } + } +}