Issue #2157855 by jessebeach | moshe weitzman: Poorly named cache id in toolbar.
parent
e58427adf6
commit
90c513b862
|
@ -238,12 +238,12 @@ class ToolbarAdminMenuTest extends WebTestBase {
|
||||||
|
|
||||||
// Assert that a cache tag in the toolbar cache under the key "user" exists
|
// Assert that a cache tag in the toolbar cache under the key "user" exists
|
||||||
// for admin_user against the language "en".
|
// 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".');
|
$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
|
// Assert that no toolbar cache exists for admin_user against the
|
||||||
// language "fr".
|
// 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".');
|
$this->assertFalse($cache, 'No toolbar cache exists for admin_user against the language "fr".');
|
||||||
|
|
||||||
// Install a second language.
|
// 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
|
// Assert that a cache tag in the toolbar cache under the key "user" exists
|
||||||
// for admin_user against the language "fr".
|
// 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".');
|
$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
|
// 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);
|
$this->assertResponse(200);
|
||||||
// Assert that a cache tag in the toolbar cache under the key "user" exists
|
// Assert that a cache tag in the toolbar cache under the key "user" exists
|
||||||
// for admin_user_2 against the language "en".
|
// 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".');
|
$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.
|
// Request a page in 'fr' to create the cache.
|
||||||
|
@ -279,7 +279,7 @@ class ToolbarAdminMenuTest extends WebTestBase {
|
||||||
$this->assertResponse(200);
|
$this->assertResponse(200);
|
||||||
// Assert that a cache tag in the toolbar cache under the key "user" exists
|
// Assert that a cache tag in the toolbar cache under the key "user" exists
|
||||||
// for admin_user against the language "fr".
|
// 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".');
|
$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.
|
// 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
|
// Assert that a cache tag in the toolbar cache under the key "user" exists
|
||||||
// for admin_user_2 against the language "en".
|
// 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".');
|
$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
|
// Assert that a cache tag in the toolbar cache under the key "user" exists
|
||||||
// for admin_user_2 against the language "fr".
|
// 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".');
|
$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
|
// Assert that a cache tag in the toolbar cache under the key "user" exists
|
||||||
// for admin_user against the language "xx".
|
// 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".');
|
$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
|
// 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.
|
* A unique cache ID for the user.
|
||||||
*/
|
*/
|
||||||
function _toolbar_get_user_cid($uid) {
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue