Commit 7c88cb72 authored by catch's avatar catch

Issue #2468151 by lhangea, rpayanm, Palashvijay4O: Rename the CacheContexts...

Issue #2468151 by lhangea, rpayanm, Palashvijay4O: Rename the CacheContexts service to CacheContextsManager
parent fc59ba20
......@@ -111,8 +111,8 @@ services:
arguments: ['@settings', '%cache_default_bin_backends%']
calls:
- [setContainer, ['@service_container']]
cache_contexts:
class: Drupal\Core\Cache\CacheContexts
cache_contexts_manager:
class: Drupal\Core\Cache\CacheContextsManager
arguments: ['@service_container', '%cache_contexts%' ]
cache_tags.invalidator:
parent: container.trait
......@@ -856,7 +856,7 @@ services:
- { name: event_subscriber }
main_content_renderer.html:
class: Drupal\Core\Render\MainContent\HtmlRenderer
arguments: ['@title_resolver', '@plugin.manager.display_variant', '@event_dispatcher', '@element_info', '@module_handler', '@renderer', '@cache_contexts']
arguments: ['@title_resolver', '@plugin.manager.display_variant', '@event_dispatcher', '@element_info', '@module_handler', '@renderer', '@cache_contexts_manager']
tags:
- { name: render.main_content_renderer, format: html }
main_content_renderer.ajax:
......@@ -961,7 +961,7 @@ services:
class: Drupal\Core\EventSubscriber\FinishResponseSubscriber
tags:
- { name: event_subscriber }
arguments: ['@language_manager', '@config.factory', '@page_cache_request_policy', '@page_cache_response_policy', '@cache_contexts']
arguments: ['@language_manager', '@config.factory', '@page_cache_request_policy', '@page_cache_response_policy', '@cache_contexts_manager']
redirect_response_subscriber:
class: Drupal\Core\EventSubscriber\RedirectResponseSubscriber
arguments: ['@url_generator', '@router.request_context']
......@@ -1351,6 +1351,6 @@ services:
lazy: true
renderer:
class: Drupal\Core\Render\Renderer
arguments: ['@controller_resolver', '@theme.manager', '@plugin.manager.element_info', '@request_stack', '@cache_factory', '@cache_contexts', '%renderer.config%']
arguments: ['@controller_resolver', '@theme.manager', '@plugin.manager.element_info', '@request_stack', '@cache_factory', '@cache_contexts_manager', '%renderer.config%']
email.validator:
class: Egulias\EmailValidator\EmailValidator
......@@ -32,7 +32,7 @@
* The cache context IDs (to vary a cache item ID based on active contexts).
*
* @see \Drupal\Core\Cache\CacheContextInterface
* @see \Drupal\Core\Cache\CacheContexts::convertTokensToKeys()
* @see \Drupal\Core\Cache\CacheContextsManager::convertTokensToKeys()
*
* @var string[]
*/
......
......@@ -37,7 +37,7 @@ public static function mergeContexts() {
$cache_contexts = array_merge($cache_contexts, $contexts);
}
$cache_contexts = array_unique($cache_contexts);
\Drupal::service('cache_contexts')->validateTokens($cache_contexts);
\Drupal::service('cache_contexts_manager')->validateTokens($cache_contexts);
sort($cache_contexts);
return $cache_contexts;
}
......
......@@ -2,7 +2,7 @@
/**
* @file
* Contains \Drupal\Core\Cache\CacheContexts.
* Contains \Drupal\Core\Cache\CacheContextsManager.
*/
namespace Drupal\Core\Cache;
......@@ -25,7 +25,7 @@
* @see \Drupal\Core\Cache\CalculatedCacheContextInterface
* @see \Drupal\Core\Cache\CacheContextsPass
*/
class CacheContexts {
class CacheContextsManager {
/**
* The service container.
......@@ -42,7 +42,7 @@ class CacheContexts {
protected $contexts;
/**
* Constructs a CacheContexts object.
* Constructs a CacheContextsManager object.
*
* @param \Symfony\Component\DependencyInjection\ContainerInterface $container
* The current service container.
......@@ -231,7 +231,7 @@ public static function parseTokens(array $context_tokens) {
*
* @throws \LogicException
*
* @see \Drupal\Core\Cache\CacheContexts::parseTokens()
* @see \Drupal\Core\Cache\CacheContextsManager::parseTokens()
*/
public function validateTokens(array $context_tokens = []) {
if (empty($context_tokens)) {
......
......@@ -24,14 +24,14 @@
* These identify a specific variation/representation of the object.
*
* Cache contexts are tokens: placeholders that are converted to cache keys by
* the @cache_contexts service. The replacement value depends on the request
* context (the current URL, language, and so on). They're converted before
* storing an object in cache.
* the @cache_contexts_manager service. The replacement value depends on the
* request context (the current URL, language, and so on). They're converted
* before storing an object in cache.
*
* @return string[]
* An array of cache context tokens, used to generate a cache ID.
*
* @see \Drupal\Core\Cache\CacheContexts::convertTokensToKeys()
* @see \Drupal\Core\Cache\CacheContextsManager::convertTokensToKeys()
*/
public function getCacheContexts();
......
......@@ -10,7 +10,7 @@
use Drupal\Component\Datetime\DateTimePlus;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheableDependencyInterface;
use Drupal\Core\Cache\CacheContexts;
use Drupal\Core\Cache\CacheContextsManager;
use Drupal\Core\Config\Config;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Language\LanguageManagerInterface;
......@@ -61,9 +61,9 @@ class FinishResponseSubscriber implements EventSubscriberInterface {
protected $responsePolicy;
/**
* The cache contexts service.
* The cache contexts manager service.
*
* @var \Drupal\Core\Cache\CacheContexts
* @var \Drupal\Core\Cache\CacheContextsManager
*/
protected $cacheContexts;
......@@ -78,15 +78,15 @@ class FinishResponseSubscriber implements EventSubscriberInterface {
* A policy rule determining the cacheability of a request.
* @param \Drupal\Core\PageCache\ResponsePolicyInterface $response_policy
* A policy rule determining the cacheability of a response.
* @param \Drupal\Core\Cache\CacheContexts $cache_contexts
* The cache contexts service.
* @param \Drupal\Core\Cache\CacheContextsManager $cache_contexts_manager
* The cache contexts manager service.
*/
public function __construct(LanguageManagerInterface $language_manager, ConfigFactoryInterface $config_factory, RequestPolicyInterface $request_policy, ResponsePolicyInterface $response_policy, CacheContexts $cache_contexts) {
public function __construct(LanguageManagerInterface $language_manager, ConfigFactoryInterface $config_factory, RequestPolicyInterface $request_policy, ResponsePolicyInterface $response_policy, CacheContextsManager $cache_contexts_manager) {
$this->languageManager = $language_manager;
$this->config = $config_factory->get('system.performance');
$this->requestPolicy = $request_policy;
$this->responsePolicy = $response_policy;
$this->cacheContexts = $cache_contexts;
$this->cacheContextsManager = $cache_contexts_manager;
}
/**
......@@ -179,7 +179,7 @@ protected function updateDrupalCacheHeaders(Response $response, CacheableDepende
$existing_cache_contexts = explode(' ', $response->headers->get('X-Drupal-Cache-Contexts'));
$cache_contexts = Cache::mergeContexts($existing_cache_contexts, $cache_contexts);
}
$response->headers->set('X-Drupal-Cache-Contexts', implode(' ', $this->cacheContexts->optimizeTokens($cache_contexts)));
$response->headers->set('X-Drupal-Cache-Contexts', implode(' ', $this->cacheContextsManager->optimizeTokens($cache_contexts)));
}
/**
......
......@@ -10,7 +10,7 @@
use Drupal\Component\Plugin\PluginManagerInterface;
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheContexts;
use Drupal\Core\Cache\CacheContextsManager;
use Drupal\Core\Controller\TitleResolverInterface;
use Drupal\Core\Display\PageVariantInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
......@@ -73,9 +73,9 @@ class HtmlRenderer implements MainContentRendererInterface {
protected $renderer;
/**
* The cache contexts service.
* The cache contexts manager service.
*
* @var \Drupal\Core\Cache\CacheContexts
* @var \Drupal\Core\Cache\CacheContextsManager
*/
protected $cacheContexts;
......@@ -94,17 +94,17 @@ class HtmlRenderer implements MainContentRendererInterface {
* The module handler.
* @param \Drupal\Core\Render\RendererInterface $renderer
* The renderer service.
* @param \Drupal\Core\Cache\CacheContexts $cache_contexts
* The cache contexts service.
* @param \Drupal\Core\Cache\CacheContextsManager $cache_contexts_manager
* The cache contexts manager service.
*/
public function __construct(TitleResolverInterface $title_resolver, PluginManagerInterface $display_variant_manager, EventDispatcherInterface $event_dispatcher, ElementInfoManagerInterface $element_info_manager, ModuleHandlerInterface $module_handler, RendererInterface $renderer, CacheContexts $cache_contexts) {
public function __construct(TitleResolverInterface $title_resolver, PluginManagerInterface $display_variant_manager, EventDispatcherInterface $event_dispatcher, ElementInfoManagerInterface $element_info_manager, ModuleHandlerInterface $module_handler, RendererInterface $renderer, CacheContextsManager $cache_contexts_manager) {
$this->titleResolver = $title_resolver;
$this->displayVariantManager = $display_variant_manager;
$this->eventDispatcher = $event_dispatcher;
$this->elementInfoManager = $element_info_manager;
$this->moduleHandler = $module_handler;
$this->renderer = $renderer;
$this->cacheContexts = $cache_contexts;
$this->cacheContextsManager = $cache_contexts_manager;
}
/**
......@@ -169,7 +169,7 @@ public function renderResponse(array $main_content, Request $request, RouteMatch
$response = new Response($content, 200,[
'X-Drupal-Cache-Tags' => implode(' ', $cache_tags),
'X-Drupal-Cache-Contexts' => implode(' ', $this->cacheContexts->optimizeTokens($cache_contexts)),
'X-Drupal-Cache-Contexts' => implode(' ', $this->cacheContextsManager->optimizeTokens($cache_contexts)),
'X-Generator' => 'Drupal ' . $version . ' (https://www.drupal.org)'
]);
return $response;
......
......@@ -11,7 +11,7 @@
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheableDependencyInterface;
use Drupal\Core\Cache\CacheContexts;
use Drupal\Core\Cache\CacheContextsManager;
use Drupal\Core\Cache\CacheFactoryInterface;
use Drupal\Core\Controller\ControllerResolverInterface;
use Drupal\Core\Theme\ThemeManagerInterface;
......@@ -59,9 +59,9 @@ class Renderer implements RendererInterface {
protected $cacheFactory;
/**
* The cache contexts service.
* The cache contexts manager service.
*
* @var \Drupal\Core\Cache\CacheContexts
* @var \Drupal\Core\Cache\CacheContextsManager
*/
protected $cacheContexts;
......@@ -92,18 +92,18 @@ class Renderer implements RendererInterface {
* The request stack.
* @param \Drupal\Core\Cache\CacheFactoryInterface $cache_factory
* The cache factory.
* @param \Drupal\Core\Cache\CacheContexts $cache_contexts
* The cache contexts service.
* @param \Drupal\Core\Cache\CacheContextsManager $cache_contexts_manager
* The cache contexts manager service.
* @param array $renderer_config
* The renderer configuration array.
*/
public function __construct(ControllerResolverInterface $controller_resolver, ThemeManagerInterface $theme, ElementInfoManagerInterface $element_info, RequestStack $request_stack, CacheFactoryInterface $cache_factory, CacheContexts $cache_contexts, array $renderer_config) {
public function __construct(ControllerResolverInterface $controller_resolver, ThemeManagerInterface $theme, ElementInfoManagerInterface $element_info, RequestStack $request_stack, CacheFactoryInterface $cache_factory, CacheContextsManager $cache_contexts_manager, array $renderer_config) {
$this->controllerResolver = $controller_resolver;
$this->theme = $theme;
$this->elementInfo = $element_info;
$this->requestStack = $request_stack;
$this->cacheFactory = $cache_factory;
$this->cacheContexts = $cache_contexts;
$this->cacheContextsManager = $cache_contexts_manager;
$this->rendererConfig = $renderer_config;
}
......@@ -755,7 +755,7 @@ protected function createCacheID(array $elements) {
if (isset($elements['#cache']['keys'])) {
$cid_parts = $elements['#cache']['keys'];
if (!empty($elements['#cache']['contexts'])) {
$contexts = $this->cacheContexts->convertTokensToKeys($elements['#cache']['contexts']);
$contexts = $this->cacheContextsManager->convertTokensToKeys($elements['#cache']['contexts']);
$cid_parts = array_merge($cid_parts, $contexts);
}
return implode(':', $cid_parts);
......
......@@ -632,7 +632,7 @@ public function testReferencedEntity() {
protected function createCacheId(array $keys, array $contexts) {
$cid_parts = $keys;
$contexts = \Drupal::service('cache_contexts')->convertTokensToKeys($contexts);
$contexts = \Drupal::service('cache_contexts_manager')->convertTokensToKeys($contexts);
$cid_parts = array_merge($cid_parts, $contexts);
return implode(':', $cid_parts);
......
......@@ -46,7 +46,7 @@ protected function setUp() {
* Tests entity render cache handling.
*/
public function testEntityViewBuilderCache() {
$cache_contexts = \Drupal::service("cache_contexts");
$cache_contexts_manager = \Drupal::service("cache_contexts_manager");
// Force a request via GET so we can get drupal_render() cache working.
$request = \Drupal::request();
......@@ -63,7 +63,7 @@ public function testEntityViewBuilderCache() {
// Get a fully built entity view render array.
$entity_test->save();
$build = $this->container->get('entity.manager')->getViewBuilder('entity_test')->view($entity_test, 'full');
$cid_parts = array_merge($build['#cache']['keys'], $cache_contexts->convertTokensToKeys(Cache::mergeContexts($build['#cache']['contexts'], ['languages:' . LanguageInterface::TYPE_INTERFACE, 'theme'])));
$cid_parts = array_merge($build['#cache']['keys'], $cache_contexts_manager->convertTokensToKeys(Cache::mergeContexts($build['#cache']['contexts'], ['languages:' . LanguageInterface::TYPE_INTERFACE, 'theme'])));
$cid = implode(':', $cid_parts);
$bin = $build['#cache']['bin'];
......@@ -95,7 +95,7 @@ public function testEntityViewBuilderCache() {
* Tests entity render cache with references.
*/
public function testEntityViewBuilderCacheWithReferences() {
$cache_contexts = \Drupal::service("cache_contexts");
$cache_contexts_manager = \Drupal::service("cache_contexts_manager");
// Force a request via GET so we can get drupal_render() cache working.
$request = \Drupal::request();
......@@ -113,7 +113,7 @@ public function testEntityViewBuilderCacheWithReferences() {
// Get a fully built entity view render array for the referenced entity.
$build = $this->container->get('entity.manager')->getViewBuilder('entity_test')->view($entity_test_reference, 'full');
$cid_parts = array_merge($build['#cache']['keys'], $cache_contexts->convertTokensToKeys(Cache::mergeContexts($build['#cache']['contexts'], ['languages:' . LanguageInterface::TYPE_INTERFACE, 'theme'])));
$cid_parts = array_merge($build['#cache']['keys'], $cache_contexts_manager->convertTokensToKeys(Cache::mergeContexts($build['#cache']['contexts'], ['languages:' . LanguageInterface::TYPE_INTERFACE, 'theme'])));
$cid_reference = implode(':', $cid_parts);
$bin_reference = $build['#cache']['bin'];
......@@ -132,7 +132,7 @@ public function testEntityViewBuilderCacheWithReferences() {
// Get a fully built entity view render array.
$build = $this->container->get('entity.manager')->getViewBuilder('entity_test')->view($entity_test, 'full');
$cid_parts = array_merge($build['#cache']['keys'], $cache_contexts->convertTokensToKeys(Cache::mergeContexts($build['#cache']['contexts'], ['languages:' . LanguageInterface::TYPE_INTERFACE, 'theme'])));
$cid_parts = array_merge($build['#cache']['keys'], $cache_contexts_manager->convertTokensToKeys(Cache::mergeContexts($build['#cache']['contexts'], ['languages:' . LanguageInterface::TYPE_INTERFACE, 'theme'])));
$cid = implode(':', $cid_parts);
$bin = $build['#cache']['bin'];
......
......@@ -69,7 +69,7 @@ public function queryParameters() {
* #pre_render callback for #type => pager that shows the pager cache context.
*/
public static function showPagerCacheContext(array $pager) {
drupal_set_message(\Drupal::service('cache_contexts')->convertTokensToKeys(['url.query_args.pagers:' . $pager['#element']])[0]);
drupal_set_message(\Drupal::service('cache_contexts_manager')->convertTokensToKeys(['url.query_args.pagers:' . $pager['#element']])[0]);
return $pager;
}
......
......@@ -301,7 +301,7 @@ public function generateResultsKey() {
'items_per_page' => $this->view->getItemsPerPage(),
'offset' => $this->view->getOffset(),
];
$key_data += \Drupal::service('cache_contexts')->convertTokensToKeys($this->displayHandler->getCacheMetadata()['contexts']);
$key_data += \Drupal::service('cache_contexts_manager')->convertTokensToKeys($this->displayHandler->getCacheMetadata()['contexts']);
$this->resultsKey = $this->view->storage->id() . ':' . $this->displayHandler->display['id'] . ':results:' . hash('sha256', serialize($key_data));
}
......
......@@ -7,7 +7,7 @@
namespace Drupal\Tests\Core\Cache;
use Drupal\Core\Cache\CacheContexts;
use Drupal\Core\Cache\CacheContextsManager;
use Drupal\Core\Cache\CacheContextInterface;
use Drupal\Core\Cache\CalculatedCacheContextInterface;
use Drupal\Core\DependencyInjection\ContainerBuilder;
......@@ -15,7 +15,7 @@
use Symfony\Component\DependencyInjection\Container;
/**
* @coversDefaultClass \Drupal\Core\Cache\CacheContexts
* @coversDefaultClass \Drupal\Core\Cache\CacheContextsManager
* @group Cache
*/
class CacheContextsTest extends UnitTestCase {
......@@ -37,9 +37,9 @@ public function testOptimizeTokens(array $context_tokens, array $optimized_conte
['a.b.c', Container::EXCEPTION_ON_INVALID_REFERENCE, new BazCacheContext()],
['x', Container::EXCEPTION_ON_INVALID_REFERENCE, new BazCacheContext()],
]));
$cache_contexts = new CacheContexts($container, $this->getContextsFixture());
$cache_contexts_manager = new CacheContextsManager($container, $this->getContextsFixture());
$this->assertSame($optimized_context_tokens, $cache_contexts->optimizeTokens($context_tokens));
$this->assertSame($optimized_context_tokens, $cache_contexts_manager->optimizeTokens($context_tokens));
}
/**
......@@ -82,9 +82,9 @@ public function providerTestOptimizeTokens() {
*/
public function testConvertTokensToKeys() {
$container = $this->getMockContainer();
$cache_contexts = new CacheContexts($container, $this->getContextsFixture());
$cache_contexts_manager = new CacheContextsManager($container, $this->getContextsFixture());
$new_keys = $cache_contexts->convertTokensToKeys([
$new_keys = $cache_contexts_manager->convertTokensToKeys([
'foo',
'baz:parameterA',
'baz:parameterB',
......@@ -106,9 +106,9 @@ public function testConvertTokensToKeys() {
*/
public function testInvalidContext() {
$container = $this->getMockContainer();
$cache_contexts = new CacheContexts($container, $this->getContextsFixture());
$cache_contexts_manager = new CacheContextsManager($container, $this->getContextsFixture());
$cache_contexts->convertTokensToKeys(["non-cache-context"]);
$cache_contexts_manager->convertTokensToKeys(["non-cache-context"]);
}
/**
......@@ -120,9 +120,9 @@ public function testInvalidContext() {
*/
public function testInvalidCalculatedContext($context_token) {
$container = $this->getMockContainer();
$cache_contexts = new CacheContexts($container, $this->getContextsFixture());
$cache_contexts_manager = new CacheContextsManager($container, $this->getContextsFixture());
$cache_contexts->convertTokensToKeys([$context_token]);
$cache_contexts_manager->convertTokensToKeys([$context_token]);
}
/**
......@@ -136,15 +136,15 @@ public function providerTestInvalidCalculatedContext() {
}
public function testAvailableContextStrings() {
$cache_contexts = new CacheContexts($this->getMockContainer(), $this->getContextsFixture());
$contexts = $cache_contexts->getAll();
$cache_contexts_manager = new CacheContextsManager($this->getMockContainer(), $this->getContextsFixture());
$contexts = $cache_contexts_manager->getAll();
$this->assertEquals(array("foo", "baz"), $contexts);
}
public function testAvailableContextLabels() {
$container = $this->getMockContainer();
$cache_contexts = new CacheContexts($container, $this->getContextsFixture());
$labels = $cache_contexts->getLabels();
$cache_contexts_manager = new CacheContextsManager($container, $this->getContextsFixture());
$labels = $cache_contexts_manager->getLabels();
$expected = array("foo" => "Foo");
$this->assertEquals($expected, $labels);
}
......@@ -205,12 +205,12 @@ public function validateTokensProvider() {
*/
public function testValidateContexts(array $contexts, $expected_exception_message) {
$container = new ContainerBuilder();
$cache_contexts = new CacheContexts($container, ['foo', 'foo.bar', 'baz']);
$cache_contexts_manager = new CacheContextsManager($container, ['foo', 'foo.bar', 'baz']);
if ($expected_exception_message !== FALSE) {
$this->setExpectedException('LogicException', $expected_exception_message);
}
// If it doesn't throw an exception, validateTokens() returns NULL.
$this->assertNull($cache_contexts->validateTokens($contexts));
$this->assertNull($cache_contexts_manager->validateTokens($contexts));
}
}
......
......@@ -40,7 +40,7 @@ public function testBubblingWithoutPreRender() {
$this->elementInfo->expects($this->any())
->method('getInfo')
->willReturn([]);
$this->cacheContexts->expects($this->any())
$this->cacheContextsManager->expects($this->any())
->method('convertTokensToKeys')
->willReturnArgument(0);
......@@ -86,7 +86,7 @@ public function testBubblingWithoutPreRender() {
public function testContextBubblingEdgeCases(array $element, array $expected_top_level_contexts, array $expected_cache_items) {
$this->setUpRequest();
$this->setupMemoryCache();
$this->cacheContexts->expects($this->any())
$this->cacheContextsManager->expects($this->any())
->method('convertTokensToKeys')
->willReturnArgument(0);
......
......@@ -195,7 +195,7 @@ public function testRenderRecursivePostRenderCache() {
public function testRenderChildrenPostRenderCacheDifferentContexts() {
$this->setUpRequest();
$this->setupMemoryCache();
$this->cacheContexts->expects($this->any())
$this->cacheContextsManager->expects($this->any())
->method('convertTokensToKeys')
->willReturnArgument(0);
$this->elementInfo->expects($this->any())
......@@ -290,7 +290,7 @@ public function testRenderChildrenPostRenderCacheDifferentContexts() {
public function testRenderChildrenPostRenderCacheComplex() {
$this->setUpRequest();
$this->setupMemoryCache();
$this->cacheContexts->expects($this->any())
$this->cacheContextsManager->expects($this->any())
->method('convertTokensToKeys')
->willReturnArgument(0);
$this->elementInfo->expects($this->any())
......
......@@ -40,7 +40,7 @@ class RendererTestBase extends UnitTestCase {
protected $cacheFactory;
/**
* @var \Drupal\Core\Cache\CacheContexts|\PHPUnit_Framework_MockObject_MockObject
* @var \Drupal\Core\Cache\CacheContextsManager|\PHPUnit_Framework_MockObject_MockObject
*/
protected $cacheContexts;
......@@ -93,10 +93,10 @@ protected function setUp() {
$this->elementInfo = $this->getMock('Drupal\Core\Render\ElementInfoManagerInterface');
$this->requestStack = new RequestStack();
$this->cacheFactory = $this->getMock('Drupal\Core\Cache\CacheFactoryInterface');
$this->cacheContexts = $this->getMockBuilder('Drupal\Core\Cache\CacheContexts')
$this->cacheContextsManager = $this->getMockBuilder('Drupal\Core\Cache\CacheContextsManager')
->disableOriginalConstructor()
->getMock();
$this->cacheContexts->expects($this->any())
$this->cacheContextsManager->expects($this->any())
->method('convertTokensToKeys')
->willReturnCallback(function($context_tokens) {
global $current_user_role;
......@@ -118,10 +118,10 @@ protected function setUp() {
}
return $keys;
});
$this->renderer = new Renderer($this->controllerResolver, $this->themeManager, $this->elementInfo, $this->requestStack, $this->cacheFactory, $this->cacheContexts, $this->rendererConfig);
$this->renderer = new Renderer($this->controllerResolver, $this->themeManager, $this->elementInfo, $this->requestStack, $this->cacheFactory, $this->cacheContextsManager, $this->rendererConfig);
$container = new ContainerBuilder();
$container->set('cache_contexts', $this->cacheContexts);
$container->set('cache_contexts_manager', $this->cacheContextsManager);
$container->set('renderer', $this->renderer);
\Drupal::setContainer($container);
}
......
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