diff --git a/core/lib/Drupal/Core/Routing/CachedUrlGenerator.php b/core/lib/Drupal/Core/Routing/CachedUrlGenerator.php index 7cf60d5..a253f4c 100644 --- a/core/lib/Drupal/Core/Routing/CachedUrlGenerator.php +++ b/core/lib/Drupal/Core/Routing/CachedUrlGenerator.php @@ -251,5 +251,4 @@ public function getPathFromRoute($name, $parameters = array()) { return $this->urlGenerator->getPathFromRoute($name, $parameters); } - } diff --git a/core/tests/Drupal/Tests/Core/Routing/CachedUrlGeneratorTest.php b/core/tests/Drupal/Tests/Core/Routing/CachedUrlGeneratorTest.php index 27c262d..3487410 100644 --- a/core/tests/Drupal/Tests/Core/Routing/CachedUrlGeneratorTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/CachedUrlGeneratorTest.php @@ -191,66 +191,4 @@ public function testGenerateFromRouteWithDifferentParameters() { $this->assertEquals('http://localhost/test-route-1/value2', $this->cachedUrlGenerator->generateFromRoute('test_route', array('key' => 'value2'), array('absolute' => TRUE))); } - /** - * Tests that prepareCache's treatment of routes is case sensitive. - * i.e. Different caches are accessed for similar but distinctly named - * requests. - * - * For example, these URLs - * - * "/PAGE/A" - * "/PAGE/a" - * - * are not the same and that when processing the request the accumulation of - * generated URLs should be cached separately. - * - * @covers \Drupal\Core\Routing\CachedUrlGenerator::prepareCache() - */ - public function testPrepareCache(){ - - // Attach a monitor to capture the number of unique caches accessed. - $this->cache->expects($this->any()) - ->method('set') - ->will($this->returnCallback(array($this, 'logCacheIdentifiers'))); - - $requestStack = new RequestStack(); - - // For a lowercase request populate the array of URLs and then cache it. - $request1 = Request::create('/page/a'); - $request1->attributes->set('_system_path', '/page/a'); - $requestStack->push($request1); - $this->cachedUrlGenerator->prepareCache($requestStack); - $this->cachedUrlGenerator->generateFromRoute('test-route-1'); - $this->cachedUrlGenerator->destruct(); // write to cache - - // For a uppercase request populate the array of URLs and then cache it. - $request2 = Request::create('/PAGE/A'); - $request2->attributes->set('_system_path', '/PAGE/A'); - $requestStack->push($request2); - $this->cachedUrlGenerator->prepareCache($requestStack); - $this->cachedUrlGenerator->generateFromRoute('test-route-1'); - $this->cachedUrlGenerator->destruct(); // write to cache. - - // Verify that two uniquely named caches have been accessed - One for each request. - $this->assertEquals(count($this->cacheIds), 2, 'Two unique caches have been stored.'); - } - - /** - * Monitor the number of distinct caches that are accessed. - * - * Build up a list of unique cache identifiers as access to them is sought. - * - * The form of the set method being mocked :- - * - * set($cid, $data, $expire = Cache::PERMANENT, array $tags = array()); - */ - public function logCacheIdentifiers() { - $arg = func_get_args(); - - // cid is insensitive to the case of the identifier. - $cid = strtolower($arg[0]); - - $this->cacheIds[$cid] = 1; - } } -