diff --git a/core/lib/Drupal/Core/Routing/RouteProvider.php b/core/lib/Drupal/Core/Routing/RouteProvider.php index bd6c475066fc5aa8cd51f3efb341e7e1f1862f75..752cf5621eed35b288ba71ffc1b504698ca51191 100644 --- a/core/lib/Drupal/Core/Routing/RouteProvider.php +++ b/core/lib/Drupal/Core/Routing/RouteProvider.php @@ -246,7 +246,7 @@ protected function getRoutesByPath($path) { $ancestors = $this->getCandidateOutlines($parts); - $routes = $this->connection->query("SELECT name, route FROM {" . $this->connection->escapeTable($this->tableName) . "} WHERE pattern_outline IN (:patterns) ORDER BY fit", array( + $routes = $this->connection->query("SELECT name, route FROM {" . $this->connection->escapeTable($this->tableName) . "} WHERE pattern_outline IN (:patterns) ORDER BY fit DESC", array( ':patterns' => $ancestors, )) ->fetchAllKeyed(); diff --git a/core/modules/system/lib/Drupal/system/Tests/Routing/RouteProviderTest.php b/core/modules/system/lib/Drupal/system/Tests/Routing/RouteProviderTest.php index 0b2bc189d991907bca0e8c932ca740343dd62779..eee9abf96a6b86a3e93f2d0a85acdc12129d088d 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Routing/RouteProviderTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Routing/RouteProviderTest.php @@ -260,8 +260,10 @@ function testOutlinePathMatchDefaultsCollision2() { try { $routes = $provider->getRouteCollectionForRequest($request); + $routes_array = $routes->all(); $this->assertEqual(count($routes), 2, 'The correct number of routes was found.'); + $this->assertEqual(array('narf', 'poink'), array_keys($routes_array), 'Ensure the fitness was taken into account.'); $this->assertNotNull($routes->get('narf'), 'The first matching route was found.'); $this->assertNotNull($routes->get('poink'), 'The second matching route was found.'); $this->assertNull($routes->get('eep'), 'Noin-matching route was not found.');