summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Catchpole2013-07-12 09:44:53 (GMT)
committer Nathaniel Catchpole2013-07-12 12:15:43 (GMT)
commit2644090a6410d5cb957c0a9eb3848bb84a6047ed (patch)
tree8f12ee77764d2ef34766ea82817497ca3842281f
parente85f89c3ccc8c521b0d9889bbb45e6d47c22adc3 (diff)
Issue #2036241 by Xano: Fixed Routing system cannot handle /foo/bar and /foo/{baz}.
-rw-r--r--core/lib/Drupal/Core/Routing/RouteProvider.php2
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Routing/RouteProviderTest.php2
2 files changed, 3 insertions, 1 deletions
diff --git a/core/lib/Drupal/Core/Routing/RouteProvider.php b/core/lib/Drupal/Core/Routing/RouteProvider.php
index bd6c475..752cf56 100644
--- a/core/lib/Drupal/Core/Routing/RouteProvider.php
+++ b/core/lib/Drupal/Core/Routing/RouteProvider.php
@@ -246,7 +246,7 @@ class RouteProvider implements RouteProviderInterface {
$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 0b2bc18..eee9abf 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 @@ class RouteProviderTest extends UnitTestBase {
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.');