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

8.0.x
webchick 2013-12-17 21:58:12 -08:00
parent e58427adf6
commit 90c513b862
2 changed files with 9 additions and 9 deletions

View File

@ -238,12 +238,12 @@ class ToolbarAdminMenuTest extends WebTestBase {
// 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 @@ class ToolbarAdminMenuTest extends WebTestBase {
// 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 @@ class ToolbarAdminMenuTest extends WebTestBase {
$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 @@ class ToolbarAdminMenuTest extends WebTestBase {
$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 @@ class ToolbarAdminMenuTest extends WebTestBase {
// 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 @@ class ToolbarAdminMenuTest extends WebTestBase {
// 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

View File

@ -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;
}
/**