Issue #3226334 by albertosilva, pauger, xjm, smustgrave, K3vin_nl, krisahil: PathAliasManager could not find the alias by the internal path

merge-requests/3202/head
xjm 2023-01-09 14:19:04 -06:00
parent bc41ac8934
commit 9cc7cfaa1c
No known key found for this signature in database
GPG Key ID: 206B0B8743BDF4C2
2 changed files with 9 additions and 2 deletions

View File

@ -221,7 +221,7 @@ class AliasManager implements AliasManagerInterface {
if (!empty($this->preloadedPathLookups[$langcode])) { if (!empty($this->preloadedPathLookups[$langcode])) {
$this->lookupMap[$langcode] = $this->pathAliasRepository->preloadPathAlias($this->preloadedPathLookups[$langcode], $langcode); $this->lookupMap[$langcode] = $this->pathAliasRepository->preloadPathAlias($this->preloadedPathLookups[$langcode], $langcode);
// Keep a record of paths with no alias to avoid querying twice. // Keep a record of paths with no alias to avoid querying twice.
$this->noAlias[$langcode] = array_flip(array_diff_key($this->preloadedPathLookups[$langcode], array_keys($this->lookupMap[$langcode]))); $this->noAlias[$langcode] = array_flip(array_diff($this->preloadedPathLookups[$langcode], array_keys($this->lookupMap[$langcode])));
} }
} }

View File

@ -259,7 +259,14 @@ class AliasManagerTest extends UnitTestCase {
$language = $this->setUpCurrentLanguage(); $language = $this->setUpCurrentLanguage();
$cached_paths = [$language->getId() => [$path]]; // Use a set of cached paths where the tested path is in any position, not
// only in the first one.
$cached_paths = [
$language->getId() => [
'/another/path',
$path,
],
];
$this->cache->expects($this->once()) $this->cache->expects($this->once())
->method('get') ->method('get')
->with($this->cacheKey) ->with($this->cacheKey)