diff --cc composer.lock index f933c55,4741c6c..0000000 --- a/composer.lock +++ b/composer.lock diff --cc core/vendor/composer/installed.json index db7fa29,002a924..0000000 --- a/core/vendor/composer/installed.json +++ b/core/vendor/composer/installed.json @@@ -2589,62 -2588,62 +2529,119 @@@ ] }, { ++<<<<<<< ours + "name": "twig/twig", + "version": "v1.16.2", + "version_normalized": "1.16.2.0", + "source": { + "type": "git", + "url": "https://github.com/fabpot/Twig.git", + "reference": "42f758d9fe2146d1f0470604fc05ee43580873fc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fabpot/Twig/zipball/42f758d9fe2146d1f0470604fc05ee43580873fc", + "reference": "42f758d9fe2146d1f0470604fc05ee43580873fc", + "shasum": "" + }, + "require": { + "php": ">=5.2.4" + }, + "time": "2014-10-17 12:53:44", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.16-dev" ++======= + "name": "symfony-cmf/routing", + "version": "1.3.0", + "version_normalized": "1.3.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony-cmf/Routing.git", + "reference": "8e87981d72c6930a27585dcd3119f3199f6cb2a6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony-cmf/Routing/zipball/8e87981d72c6930a27585dcd3119f3199f6cb2a6", + "reference": "8e87981d72c6930a27585dcd3119f3199f6cb2a6", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "psr/log": "~1.0", + "symfony/http-kernel": "~2.2", + "symfony/routing": "~2.2" + }, + "require-dev": { + "symfony/config": "~2.2", + "symfony/dependency-injection": "~2.0@stable", + "symfony/event-dispatcher": "~2.1" + }, + "suggest": { + "symfony/event-dispatcher": "DynamicRouter can optionally trigger an event at the start of matching. Minimal version ~2.1" + }, + "time": "2014-10-20 20:55:17", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" ++>>>>>>> theirs } }, "installation-source": "dist", "autoload": { ++<<<<<<< ours + "psr-0": { + "Twig_": "lib/" ++======= + "psr-4": { + "Symfony\\Cmf\\Component\\Routing\\": "" ++>>>>>>> theirs } }, "notification-url": "https://packagist.org/downloads/", "license": [ ++<<<<<<< ours + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, + { + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" + }, + { + "name": "Twig Team", + "homepage": "https://github.com/fabpot/Twig/graphs/contributors", + "role": "Contributors" + } + ], + "description": "Twig, the flexible, fast, and secure template language for PHP", + "homepage": "http://twig.sensiolabs.org", + "keywords": [ + "templating" ++======= + "MIT" + ], + "authors": [ + { + "name": "Symfony CMF Community", + "homepage": "https://github.com/symfony-cmf/Routing/contributors" + } + ], + "description": "Extends the Symfony2 routing component for dynamic routes and chaining several routers", + "homepage": "http://cmf.symfony.com", + "keywords": [ + "database", + "routing" ++>>>>>>> theirs ] } ] diff --git a/core/lib/Drupal/Core/Routing/RouteProvider.php b/core/lib/Drupal/Core/Routing/RouteProvider.php index a71f04c..06c3ea7 100644 --- a/core/lib/Drupal/Core/Routing/RouteProvider.php +++ b/core/lib/Drupal/Core/Routing/RouteProvider.php @@ -330,10 +330,14 @@ static function getSubscribedEvents() { * {@inheritdoc} */ public function getRoutesPaged($offset, $length = NULL) { - $routes = $this->connection->select($this->tableName, 'router') - ->fields('router', ['name', 'route']) - ->range($offset, $length) - ->fetchAllKeyed(); + $select = $this->connection->select($this->tableName, 'router') + ->fields('router', ['name', 'route']); + + if ($length) { + $select->range($offset, $length); + } + + $routes = $select->execute()->fetchAllKeyed(); $result = []; foreach ($routes as $name => $route) { diff --git a/core/modules/system/src/Tests/Routing/RouteProviderTest.php b/core/modules/system/src/Tests/Routing/RouteProviderTest.php index b453feb..6b6e1d7 100644 --- a/core/modules/system/src/Tests/Routing/RouteProviderTest.php +++ b/core/modules/system/src/Tests/Routing/RouteProviderTest.php @@ -461,4 +461,27 @@ public function testGetRoutesByPatternWithLongPatterns() { $this->assertEqual(count($candidates), 7); } + /** + * Tests getRoutesPaged(). + */ + public function testGetRoutesPaged() { + $connection = Database::getConnection(); + $provider = new RouteProvider($connection, $this->routeBuilder, $this->state, 'test_routes'); + + $this->fixtures->createTables($connection); + $dumper = new MatcherDumper($connection, $this->state, 'test_routes'); + $dumper->addRoutes($this->fixtures->sampleRouteCollection()); + $dumper->dump(); + + $fixture_routes = $this->fixtures->staticSampleRouteCollection(); + + // Query all the routes. + $routes = $provider->getRoutesPaged(0); + $this->assertEqual(array_keys($routes), array_keys($fixture_routes)); + + // Query a limited sets of routes. + $routes = $provider->getRoutesPaged(1, 2); + $this->assertEqual(array_keys($routes), array_slice(array_keys($fixture_routes), 1, 2)); + } + }