core/modules/block/src/Tests/BlockViewBuilderTest.php | 7 ++++--- core/modules/dblog/src/Tests/Views/ViewsIntegrationTest.php | 2 +- .../src/Tests/MenuLinkContentCacheabilityBubblingTest.php | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/core/modules/block/src/Tests/BlockViewBuilderTest.php b/core/modules/block/src/Tests/BlockViewBuilderTest.php index 02fec0f..bd668b5 100644 --- a/core/modules/block/src/Tests/BlockViewBuilderTest.php +++ b/core/modules/block/src/Tests/BlockViewBuilderTest.php @@ -10,6 +10,7 @@ use Drupal\Component\Utility\Html; use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\UrlCacheContext; +use Drupal\Core\Language\LanguageInterface; use Drupal\simpletest\KernelTestBase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; @@ -27,7 +28,7 @@ class BlockViewBuilderTest extends KernelTestBase { * * @var array */ - public static $modules = array('block', 'block_test', 'system'); + public static $modules = array('block', 'block_test', 'system', 'user'); /** * The block being tested. @@ -151,7 +152,7 @@ protected function verifyRenderCacheHandling() { // Test that a cache entry is created. $build = $this->getBlockRenderArray(); - $cid = 'entity_view:block:test_block:en:core'; + $cid = 'entity_view:block:test_block:' . implode(':', \Drupal::service('cache_contexts_manager')->convertTokensToKeys(['languages:' . LanguageInterface::TYPE_INTERFACE, 'theme', 'user.permissions'])); drupal_render($build); $this->assertTrue($this->container->get('cache.render')->get($cid), 'The block render element has been cached.'); @@ -205,7 +206,7 @@ public function testBlockViewBuilderAlter() { // Advanced: cached block, but an alter hook adds an additional cache key. $alter_add_key = $this->randomMachineName(); \Drupal::state()->set('block_test_view_alter_cache_key', $alter_add_key); - $cid = 'entity_view:block:test_block:' . $alter_add_key . ':en:core'; + $cid = 'entity_view:block:test_block:' . $alter_add_key . ':' . implode(':', \Drupal::service('cache_contexts_manager')->convertTokensToKeys(['languages:' . LanguageInterface::TYPE_INTERFACE, 'theme', 'user.permissions'])); $expected_keys = array_merge($default_keys, array($alter_add_key)); $build = $this->getBlockRenderArray(); $this->assertIdentical($expected_keys, $build['#cache']['keys'], 'An altered cacheable block has the expected cache keys.'); diff --git a/core/modules/dblog/src/Tests/Views/ViewsIntegrationTest.php b/core/modules/dblog/src/Tests/Views/ViewsIntegrationTest.php index c7f3797..063ce25 100644 --- a/core/modules/dblog/src/Tests/Views/ViewsIntegrationTest.php +++ b/core/modules/dblog/src/Tests/Views/ViewsIntegrationTest.php @@ -34,7 +34,7 @@ class ViewsIntegrationTest extends ViewUnitTestBase { * * @var array */ - public static $modules = array('dblog', 'dblog_test_views'); + public static $modules = array('dblog', 'dblog_test_views', 'user'); /** * {@inheritdoc} diff --git a/core/modules/menu_link_content/src/Tests/MenuLinkContentCacheabilityBubblingTest.php b/core/modules/menu_link_content/src/Tests/MenuLinkContentCacheabilityBubblingTest.php index 7980c77..80ab050 100644 --- a/core/modules/menu_link_content/src/Tests/MenuLinkContentCacheabilityBubblingTest.php +++ b/core/modules/menu_link_content/src/Tests/MenuLinkContentCacheabilityBubblingTest.php @@ -69,7 +69,7 @@ public function testOutboundPathAndRouteProcessing() { $default_menu_cacheability = (new CacheableMetadata()) ->setCacheMaxAge(Cache::PERMANENT) ->setCacheTags(['config:system.menu.tools']) - ->setCacheContexts(['languages:' . LanguageInterface::TYPE_INTERFACE, 'theme']); + ->setCacheContexts(['languages:' . LanguageInterface::TYPE_INTERFACE, 'theme', 'user.permissions']); User::create(['uid' => 1, 'name' => $this->randomString()])->save(); User::create(['uid' => 2, 'name' => $this->randomString()])->save();