Commit 90c513b8 authored by webchick's avatar webchick

Issue #2157855 by jessebeach | moshe weitzman: Poorly named cache id in toolbar.

parent e58427ad
......@@ -238,12 +238,12 @@ function testCacheClearByCacheTag() {
// Assert that a cache tag in the toolbar cache under the key "user" exists
// for admin_user against the language "en".
$cache = $toolbarCache->get($admin_user_id . ':' . 'en');
$cache = $toolbarCache->get('toolbar_' . $admin_user_id . ':' . 'en');
$this->assertEqual($cache->tags[0], 'user:' . $admin_user_id, 'A cache tag in the toolbar cache under the key "user" exists for admin_user against the language "en".');
// Assert that no toolbar cache exists for admin_user against the
// language "fr".
$cache = $toolbarCache->get($admin_user_id . ':' . 'fr');
$cache = $toolbarCache->get('toolbar_' . $admin_user_id . ':' . 'fr');
$this->assertFalse($cache, 'No toolbar cache exists for admin_user against the language "fr".');
// Install a second language.
......@@ -258,7 +258,7 @@ function testCacheClearByCacheTag() {
// Assert that a cache tag in the toolbar cache under the key "user" exists
// for admin_user against the language "fr".
$cache = $toolbarCache->get($admin_user_id . ':' . 'fr');
$cache = $toolbarCache->get('toolbar_' . $admin_user_id . ':' . 'fr');
$this->assertEqual($cache->tags[0], 'user:' . $admin_user_id, 'A cache tag in the toolbar cache under the key "user" exists for admin_user against the language "fr".');
// Log in the admin_user_2 user. We will use this user as a control to
......@@ -271,7 +271,7 @@ function testCacheClearByCacheTag() {
$this->assertResponse(200);
// Assert that a cache tag in the toolbar cache under the key "user" exists
// for admin_user_2 against the language "en".
$cache = $toolbarCache->get($admin_user_2_id . ':' . 'en');
$cache = $toolbarCache->get('toolbar_' . $admin_user_2_id . ':' . 'en');
$this->assertEqual($cache->tags[0], 'user:' . $admin_user_2_id, 'A cache tag in the toolbar cache under the key "user" exists for admin_user_2 against the language "en".');
// Request a page in 'fr' to create the cache.
......@@ -279,7 +279,7 @@ function testCacheClearByCacheTag() {
$this->assertResponse(200);
// Assert that a cache tag in the toolbar cache under the key "user" exists
// for admin_user against the language "fr".
$cache = $toolbarCache->get($admin_user_2_id . ':' . 'fr');
$cache = $toolbarCache->get('toolbar_' . $admin_user_2_id . ':' . 'fr');
$this->assertEqual($cache->tags[0], 'user:' . $admin_user_2_id, 'A cache tag in the toolbar cache under the key "user" exists for admin_user_2 against the language "fr".');
// Log in admin_user and clear the caches for this user using a tag.
......@@ -301,12 +301,12 @@ function testCacheClearByCacheTag() {
// Assert that a cache tag in the toolbar cache under the key "user" exists
// for admin_user_2 against the language "en".
$cache = $toolbarCache->get($admin_user_2_id . ':' . 'en');
$cache = $toolbarCache->get('toolbar_' . $admin_user_2_id . ':' . 'en');
$this->assertEqual($cache->tags[0], 'user:' . $admin_user_2_id, 'A cache tag in the toolbar cache under the key "user" exists for admin_user_2 against the language "en".');
// Assert that a cache tag in the toolbar cache under the key "user" exists
// for admin_user_2 against the language "fr".
$cache = $toolbarCache->get($admin_user_2_id . ':' . 'fr');
$cache = $toolbarCache->get('toolbar_' . $admin_user_2_id . ':' . 'fr');
$this->assertEqual($cache->tags[0], 'user:' . $admin_user_2_id, 'A cache tag in the toolbar cache under the key "user" exists for admin_user_2 against the language "fr".');
}
......@@ -390,7 +390,7 @@ function testLocaleTranslationSubtreesHashCacheClear() {
// Assert that a cache tag in the toolbar cache under the key "user" exists
// for admin_user against the language "xx".
$cache = $toolbarCache->get($admin_user_id . ':' . $langcode);
$cache = $toolbarCache->get('toolbar_' . $admin_user_id . ':' . $langcode);
$this->assertEqual($cache->tags[0], 'user:' . $admin_user_id, 'A cache tag in the toolbar cache under the key "user" exists for admin_user against the language "xx".');
// Get a baseline hash for the admin menu subtrees before translating one
......
......@@ -690,7 +690,7 @@ function toolbar_user_role_update(RoleInterface $role) {
* A unique cache ID for the user.
*/
function _toolbar_get_user_cid($uid) {
return $uid . ':' . \Drupal::languageManager()->getLanguage(Language::TYPE_INTERFACE)->id;
return 'toolbar_' . $uid . ':' . \Drupal::languageManager()->getLanguage(Language::TYPE_INTERFACE)->id;
}
/**
......
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