Commit 5168706f authored by alexpott's avatar alexpott

Issue #2501183 by borisson_, dileepmaurya, Gábor Hojtsy, Berdir: LocaleLookup...

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 8ddd1342
......@@ -117,7 +117,7 @@ protected function getCid() {
// for example, strings for admin menu items and settings forms are not
// cached for anonymous users.
$user = \Drupal::currentUser();
$rids = $user ? implode(':', array_keys($user->getRoles())) : '0';
$rids = $user ? implode(':', $user->getRoles()) : '';
$this->cid = "locale:{$this->langcode}:{$this->context}:$rids";
// Getting the roles from the current user might have resulted in t()
......
......@@ -111,7 +111,7 @@ public function testResolveCacheMissWithoutFallback() {
$this->cache->expects($this->once())
->method('get')
->with('locale:en:irrelevant:0', FALSE);
->with('locale:en:irrelevant:anonymous', FALSE);
$this->storage->expects($this->once())
->method('findTranslation')
......@@ -183,7 +183,7 @@ public function testResolveCacheMissWithFallback($langcode, $string, $context, $
$this->cache->expects($this->once())
->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);
$this->assertSame($expected, $locale_lookup->get($string));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment