Issue #2501183 by borisson_, dileepmaurya, Gábor Hojtsy, Berdir: LocaleLookup cache ID is using numeric indexes of the roles field, not role ID's
parent
8ddd134295
commit
5168706ffa
|
@ -117,7 +117,7 @@ class LocaleLookup extends CacheCollector {
|
||||||
// for example, strings for admin menu items and settings forms are not
|
// for example, strings for admin menu items and settings forms are not
|
||||||
// cached for anonymous users.
|
// cached for anonymous users.
|
||||||
$user = \Drupal::currentUser();
|
$user = \Drupal::currentUser();
|
||||||
$rids = $user ? implode(':', array_keys($user->getRoles())) : '0';
|
$rids = $user ? implode(':', $user->getRoles()) : '';
|
||||||
$this->cid = "locale:{$this->langcode}:{$this->context}:$rids";
|
$this->cid = "locale:{$this->langcode}:{$this->context}:$rids";
|
||||||
|
|
||||||
// Getting the roles from the current user might have resulted in t()
|
// Getting the roles from the current user might have resulted in t()
|
||||||
|
|
|
@ -111,7 +111,7 @@ class LocaleLookupTest extends UnitTestCase {
|
||||||
|
|
||||||
$this->cache->expects($this->once())
|
$this->cache->expects($this->once())
|
||||||
->method('get')
|
->method('get')
|
||||||
->with('locale:en:irrelevant:0', FALSE);
|
->with('locale:en:irrelevant:anonymous', FALSE);
|
||||||
|
|
||||||
$this->storage->expects($this->once())
|
$this->storage->expects($this->once())
|
||||||
->method('findTranslation')
|
->method('findTranslation')
|
||||||
|
@ -183,7 +183,7 @@ class LocaleLookupTest extends UnitTestCase {
|
||||||
|
|
||||||
$this->cache->expects($this->once())
|
$this->cache->expects($this->once())
|
||||||
->method('get')
|
->method('get')
|
||||||
->with('locale:' . $langcode . ':' . $context . ':0', FALSE);
|
->with('locale:' . $langcode . ':' . $context . ':anonymous', FALSE);
|
||||||
|
|
||||||
$locale_lookup = new LocaleLookup($langcode, $context, $this->storage, $this->cache, $this->lock, $this->configFactory, $this->languageManager, $this->requestStack);
|
$locale_lookup = new LocaleLookup($langcode, $context, $this->storage, $this->cache, $this->lock, $this->configFactory, $this->languageManager, $this->requestStack);
|
||||||
$this->assertSame($expected, $locale_lookup->get($string));
|
$this->assertSame($expected, $locale_lookup->get($string));
|
||||||
|
|
Loading…
Reference in New Issue