Commit b1128351 authored by catch's avatar catch

Issue #2175823 by damiankloip, olli: Remove calls to invalidate/deleteTags on bins.

parent 387d5858
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
use Drupal\Component\Utility\NestedArray; use Drupal\Component\Utility\NestedArray;
use Drupal\Component\Utility\String; use Drupal\Component\Utility\String;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Language\Language; use Drupal\Core\Language\Language;
use Drupal\Core\Routing\RequestHelper; use Drupal\Core\Routing\RequestHelper;
...@@ -480,7 +481,7 @@ function menu_get_item($path = NULL, $router_item = NULL) { ...@@ -480,7 +481,7 @@ function menu_get_item($path = NULL, $router_item = NULL) {
if (\Drupal::state()->get('menu_rebuild_needed') || !\Drupal::state()->get('menu.masks')) { if (\Drupal::state()->get('menu_rebuild_needed') || !\Drupal::state()->get('menu.masks')) {
menu_router_rebuild(); menu_router_rebuild();
\Drupal::service('router.builder')->rebuild(); \Drupal::service('router.builder')->rebuild();
\Drupal::cache()->deleteTags(array('local_task' => 1)); Cache::deleteTags(array('local_task' => 1));
} }
$original_map = arg(NULL, $path); $original_map = arg(NULL, $path);
...@@ -2480,7 +2481,7 @@ function menu_get_active_title() { ...@@ -2480,7 +2481,7 @@ function menu_get_active_title() {
* Clears the cached cached data for a single named menu. * Clears the cached cached data for a single named menu.
*/ */
function menu_cache_clear($menu_name = 'tools') { function menu_cache_clear($menu_name = 'tools') {
cache('menu')->deleteTags(array('menu' => $menu_name)); Cache::deleteTags(array('menu' => $menu_name));
// Also clear the menu system static caches. // Also clear the menu system static caches.
menu_reset_static_cache(); menu_reset_static_cache();
} }
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* Schema API handling functions. * Schema API handling functions.
*/ */
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Database\Database; use Drupal\Core\Database\Database;
use Drupal\Core\Utility\SchemaCache; use Drupal\Core\Utility\SchemaCache;
...@@ -94,7 +95,7 @@ function drupal_get_complete_schema($rebuild = FALSE) { ...@@ -94,7 +95,7 @@ function drupal_get_complete_schema($rebuild = FALSE) {
drupal_alter('schema', $schema); drupal_alter('schema', $schema);
if ($rebuild) { if ($rebuild) {
cache()->deleteTags(array('schema' => TRUE)); Cache::deleteTags(array('schema' => TRUE));
} }
// If the schema is empty, avoid saving it: some database engines require // If the schema is empty, avoid saving it: some database engines require
// the schema to perform queries, and this could lead to infinite loops. // the schema to perform queries, and this could lead to infinite loops.
......
...@@ -268,7 +268,7 @@ public function reset() { ...@@ -268,7 +268,7 @@ public function reset() {
public function clear() { public function clear() {
$this->reset(); $this->reset();
if ($this->tags) { if ($this->tags) {
$this->cache->deleteTags($this->tags); Cache::deleteTags($this->tags);
} }
else { else {
$this->cache->delete($this->cid); $this->cache->delete($this->cid);
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
use Drupal\Component\Utility\NestedArray; use Drupal\Component\Utility\NestedArray;
use Drupal\Component\Utility\String; use Drupal\Component\Utility\String;
use Drupal\Core\Field\FieldDefinition; use Drupal\Core\Field\FieldDefinition;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Language\LanguageManager; use Drupal\Core\Language\LanguageManager;
...@@ -395,7 +396,7 @@ public function getFieldDefinitionsByConstraints($entity_type, array $constraint ...@@ -395,7 +396,7 @@ public function getFieldDefinitionsByConstraints($entity_type, array $constraint
public function clearCachedFieldDefinitions() { public function clearCachedFieldDefinitions() {
unset($this->entityFieldInfo); unset($this->entityFieldInfo);
unset($this->fieldDefinitions); unset($this->fieldDefinitions);
$this->cache->deleteTags(array('entity_field_info' => TRUE)); Cache::deleteTags(array('entity_field_info' => TRUE));
} }
/** /**
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
namespace Drupal\Core\Entity; namespace Drupal\Core\Entity;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface; use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Language\Language; use Drupal\Core\Language\Language;
...@@ -261,10 +262,10 @@ public function resetCache(array $entities = NULL) { ...@@ -261,10 +262,10 @@ public function resetCache(array $entities = NULL) {
$tags[$this->entityType][$id] = $id; $tags[$this->entityType][$id] = $id;
$tags[$this->entityType . '_view_' . $entity->bundle()] = TRUE; $tags[$this->entityType . '_view_' . $entity->bundle()] = TRUE;
} }
\Drupal::cache($this->cacheBin)->deleteTags($tags); Cache::deleteTags($tags);
} }
else { else {
\Drupal::cache($this->cacheBin)->deleteTags(array($this->entityType . '_view' => TRUE)); Cache::deleteTags(array($this->entityType . '_view' => TRUE));
} }
} }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace Drupal\Core\Extension; namespace Drupal\Core\Extension;
use Drupal\Component\Utility\String; use Drupal\Component\Utility\String;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Config\ConfigFactory; use Drupal\Core\Config\ConfigFactory;
use Drupal\Core\Config\ConfigInstallerInterface; use Drupal\Core\Config\ConfigInstallerInterface;
...@@ -465,7 +466,7 @@ protected function resetSystem() { ...@@ -465,7 +466,7 @@ protected function resetSystem() {
// @todo It feels wrong to have the requirement to clear the local tasks // @todo It feels wrong to have the requirement to clear the local tasks
// cache here. // cache here.
$this->cacheBackend->deleteTags(array('local_task' => 1)); Cache::deleteTags(array('local_task' => 1));
$this->themeRegistryRebuild(); $this->themeRegistryRebuild();
} }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace Drupal\Core\Plugin; namespace Drupal\Core\Plugin;
use Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface; use Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Plugin\Discovery\ContainerDerivativeDiscoveryDecorator; use Drupal\Core\Plugin\Discovery\ContainerDerivativeDiscoveryDecorator;
use Drupal\Component\Plugin\PluginManagerBase; use Drupal\Component\Plugin\PluginManagerBase;
use Drupal\Component\Plugin\PluginManagerInterface; use Drupal\Component\Plugin\PluginManagerInterface;
...@@ -184,7 +185,7 @@ public function clearCachedDefinitions() { ...@@ -184,7 +185,7 @@ public function clearCachedDefinitions() {
if ($this->cacheBackend) { if ($this->cacheBackend) {
if ($this->cacheTags) { if ($this->cacheTags) {
// Use the cache tags to clear the cache. // Use the cache tags to clear the cache.
$this->cacheBackend->deleteTags($this->cacheTags); Cache::deleteTags($this->cacheTags);
} }
elseif ($this->languageManager) { elseif ($this->languageManager) {
$cache_keys = array(); $cache_keys = array();
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
use Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface; use Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface;
use Drupal\Component\Plugin\Discovery\DiscoveryInterface; use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\CacheBackendInterface;
/** /**
...@@ -157,7 +158,7 @@ protected function setCachedDefinitions($definitions) { ...@@ -157,7 +158,7 @@ protected function setCachedDefinitions($definitions) {
public function clearCachedDefinitions() { public function clearCachedDefinitions() {
// If there are any cache tags, clear cache based on those. // If there are any cache tags, clear cache based on those.
if (!empty($this->cacheTags)) { if (!empty($this->cacheTags)) {
$this->cache($this->cacheBin)->deleteTags($this->cacheTags); Cache::deleteTags($this->cacheTags);
} }
// Otherwise, just delete the specified cache key. // Otherwise, just delete the specified cache key.
else if (isset($this->cacheKey)) { else if (isset($this->cacheKey)) {
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
namespace Drupal\Core\Theme; namespace Drupal\Core\Theme;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\DestructableInterface; use Drupal\Core\DestructableInterface;
use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Extension\ModuleHandlerInterface;
...@@ -550,7 +551,7 @@ public function reset() { ...@@ -550,7 +551,7 @@ public function reset() {
$this->runtimeRegistry = NULL; $this->runtimeRegistry = NULL;
$this->registry = NULL; $this->registry = NULL;
$this->cache->invalidateTags(array('theme_registry' => TRUE)); Cache::invalidateTags(array('theme_registry' => TRUE));
return $this; return $this;
} }
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
namespace Drupal\field; namespace Drupal\field;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Config\ConfigFactory; use Drupal\Core\Config\ConfigFactory;
use Drupal\Core\Field\FieldTypePluginManager; use Drupal\Core\Field\FieldTypePluginManager;
...@@ -160,7 +161,7 @@ public function flush() { ...@@ -160,7 +161,7 @@ public function flush() {
$this->bundleExtraFields = array(); $this->bundleExtraFields = array();
$this->cacheBackend->deleteTags(array('field_info' => TRUE)); Cache::deleteTags(array('field_info' => TRUE));
} }
/** /**
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
*/ */
use Drupal\Component\Utility\String; use Drupal\Component\Utility\String;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Language\Language; use Drupal\Core\Language\Language;
use Drupal\Core\Session\AccountInterface; use Drupal\Core\Session\AccountInterface;
...@@ -229,7 +230,7 @@ function filter_formats(AccountInterface $account = NULL) { ...@@ -229,7 +230,7 @@ function filter_formats(AccountInterface $account = NULL) {
* @see filter_formats() * @see filter_formats()
*/ */
function filter_formats_reset() { function filter_formats_reset() {
cache()->deleteTags(array('filter_formats' => TRUE)); Cache::deleteTags(array('filter_formats' => TRUE));
drupal_static_reset('filter_formats'); drupal_static_reset('filter_formats');
} }
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
namespace Drupal\filter\Entity; namespace Drupal\filter\Entity;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Config\Entity\ConfigEntityBase; use Drupal\Core\Config\Entity\ConfigEntityBase;
use Drupal\Core\Entity\EntityStorageControllerInterface; use Drupal\Core\Entity\EntityStorageControllerInterface;
use Drupal\filter\FilterFormatInterface; use Drupal\filter\FilterFormatInterface;
...@@ -183,7 +184,7 @@ public function disable() { ...@@ -183,7 +184,7 @@ public function disable() {
// Clear the filter cache whenever a text format is disabled. // Clear the filter cache whenever a text format is disabled.
filter_formats_reset(); filter_formats_reset();
cache('filter')->deleteTags(array('filter_format' => $this->format)); Cache::deleteTags(array('filter_format' => $this->format));
return $this; return $this;
} }
...@@ -220,7 +221,7 @@ public function postSave(EntityStorageControllerInterface $storage_controller, $ ...@@ -220,7 +221,7 @@ public function postSave(EntityStorageControllerInterface $storage_controller, $
if ($update) { if ($update) {
// Clear the filter cache whenever a text format is updated. // Clear the filter cache whenever a text format is updated.
cache('filter')->deleteTags(array('filter_format' => $this->id())); Cache::deleteTags(array('filter_format' => $this->id()));
} }
else { else {
// Default configuration of modules and installation profiles is allowed // Default configuration of modules and installation profiles is allowed
......
...@@ -141,7 +141,7 @@ function testStringTranslation() { ...@@ -141,7 +141,7 @@ function testStringTranslation() {
$this->assertRaw($translation_to_en, 'English translation properly saved.'); $this->assertRaw($translation_to_en, 'English translation properly saved.');
// Reset the tag cache on the tester side in order to pick up the call to // Reset the tag cache on the tester side in order to pick up the call to
// cache()->deleteTags() on the tested side. // Cache::deleteTags() on the tested side.
drupal_static_reset('Drupal\Core\Cache\CacheBackendInterface::tagCache'); drupal_static_reset('Drupal\Core\Cache\CacheBackendInterface::tagCache');
$this->assertTrue($name != $translation && t($name, array(), array('langcode' => $langcode)) == $translation, 't() works for non-English.'); $this->assertTrue($name != $translation && t($name, array(), array('langcode' => $langcode)) == $translation, 't() works for non-English.');
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
* object files are supported. * object files are supported.
*/ */
use Drupal\Core\Cache\Cache;
use Drupal\Core\Language\Language; use Drupal\Core\Language\Language;
use Drupal\Component\Utility\Crypt; use Drupal\Component\Utility\Crypt;
...@@ -1122,7 +1123,7 @@ function _locale_refresh_translations($langcodes, $lids = array()) { ...@@ -1122,7 +1123,7 @@ function _locale_refresh_translations($langcodes, $lids = array()) {
} }
} }
// Clear locale cache. // Clear locale cache.
cache()->deleteTags(array('locale' => TRUE)); Cache::deleteTags(array('locale' => TRUE));
} }
/** /**
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace Drupal\node\Entity; namespace Drupal\node\Entity;
use Drupal\Component\Utility\NestedArray; use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Config\Entity\ConfigEntityBase; use Drupal\Core\Config\Entity\ConfigEntityBase;
use Drupal\Core\Entity\EntityStorageControllerInterface; use Drupal\Core\Entity\EntityStorageControllerInterface;
use Drupal\node\NodeTypeInterface; use Drupal\node\NodeTypeInterface;
...@@ -164,7 +165,7 @@ public function postSave(EntityStorageControllerInterface $storage_controller, $ ...@@ -164,7 +165,7 @@ public function postSave(EntityStorageControllerInterface $storage_controller, $
if (!$update) { if (!$update) {
// Clear the node type cache, so the new type appears. // Clear the node type cache, so the new type appears.
\Drupal::cache()->deleteTags(array('node_types' => TRUE)); Cache::deleteTags(array('node_types' => TRUE));
entity_invoke_bundle_hook('create', 'node', $this->id()); entity_invoke_bundle_hook('create', 'node', $this->id());
...@@ -177,7 +178,7 @@ public function postSave(EntityStorageControllerInterface $storage_controller, $ ...@@ -177,7 +178,7 @@ public function postSave(EntityStorageControllerInterface $storage_controller, $
} }
elseif ($this->getOriginalId() != $this->id()) { elseif ($this->getOriginalId() != $this->id()) {
// Clear the node type cache to reflect the rename. // Clear the node type cache to reflect the rename.
\Drupal::cache()->deleteTags(array('node_types' => TRUE)); Cache::deleteTags(array('node_types' => TRUE));
$update_count = node_type_update_nodes($this->getOriginalId(), $this->id()); $update_count = node_type_update_nodes($this->getOriginalId(), $this->id());
if ($update_count) { if ($update_count) {
...@@ -193,7 +194,7 @@ public function postSave(EntityStorageControllerInterface $storage_controller, $ ...@@ -193,7 +194,7 @@ public function postSave(EntityStorageControllerInterface $storage_controller, $
} }
else { else {
// Invalidate the cache tag of the updated node type only. // Invalidate the cache tag of the updated node type only.
cache()->invalidateTags(array('node_type' => $this->id())); Cache::invalidateTags(array('node_type' => $this->id()));
} }
} }
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* Admin page callbacks for the system module. * Admin page callbacks for the system module.
*/ */
use Drupal\Core\Cache\Cache;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
...@@ -37,7 +38,7 @@ function system_theme_default() { ...@@ -37,7 +38,7 @@ function system_theme_default() {
// enabled. // enabled.
\Drupal::service('router.builder')->rebuild(); \Drupal::service('router.builder')->rebuild();
menu_router_rebuild(); menu_router_rebuild();
\Drupal::cache('cache')->deleteTags(array('local_task' => 1)); Cache::deleteTags(array('local_task' => TRUE));
// The status message depends on whether an admin theme is currently in use: // The status message depends on whether an admin theme is currently in use:
// a value of 0 means the admin theme is set to be the default theme. // a value of 0 means the admin theme is set to be the default theme.
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
namespace Drupal\toolbar\Tests; namespace Drupal\toolbar\Tests;
use Drupal\Core\Cache\Cache;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
/** /**
...@@ -284,7 +285,7 @@ function testCacheClearByCacheTag() { ...@@ -284,7 +285,7 @@ function testCacheClearByCacheTag() {
// 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.
$this->drupalLogin($this->admin_user); $this->drupalLogin($this->admin_user);
$toolbarCache->deleteTags(array('user' => array($admin_user_id))); Cache::deleteTags(array('user' => array($admin_user_id)));
// Assert that no toolbar cache exists for admin_user against the // Assert that no toolbar cache exists for admin_user against the
// language "en". // language "en".
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* Administration toolbar for quick access to top level administration items. * Administration toolbar for quick access to top level administration items.
*/ */
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Language\Language; use Drupal\Core\Language\Language;
use Drupal\Core\Template\Attribute; use Drupal\Core\Template\Attribute;
...@@ -652,7 +653,7 @@ function _toolbar_clear_user_cache($uid = NULL) { ...@@ -652,7 +653,7 @@ function _toolbar_clear_user_cache($uid = NULL) {
// Clear by the 'user' tag in order to delete all caches, in any language, // Clear by the 'user' tag in order to delete all caches, in any language,
// associated with this user. // associated with this user.
if (isset($uid)) { if (isset($uid)) {
$cache->deleteTags(array('user' => array($uid))); Cache::deleteTags(array('user' => array($uid)));
} else { } else {
$cache->deleteAll(); $cache->deleteAll();
} }
......
...@@ -73,7 +73,7 @@ function hook_tour_presave($entity) { ...@@ -73,7 +73,7 @@ function hook_tour_presave($entity) {
*/ */
function hook_tour_insert($entity) { function hook_tour_insert($entity) {
\Drupal::service('plugin.manager.tour.tip')->clearCachedDefinitions(); \Drupal::service('plugin.manager.tour.tip')->clearCachedDefinitions();
cache('cache_tour')->deleteTags(array('tour_items')); \Drupal\Core\Cache\Cache::deleteTags(array('tour_items'));
} }
/** /**
...@@ -84,5 +84,5 @@ function hook_tour_insert($entity) { ...@@ -84,5 +84,5 @@ function hook_tour_insert($entity) {
*/ */
function hook_tour_update($entity) { function hook_tour_update($entity) {
\Drupal::service('plugin.manager.tour.tip')->clearCachedDefinitions(); \Drupal::service('plugin.manager.tour.tip')->clearCachedDefinitions();
cache('cache_tour')->deleteTags(array('tour_items')); \Drupal\Core\Cache\Cache::deleteTags(array('tour_items'));
} }
...@@ -627,7 +627,7 @@ function hook_views_ui_display_top_links_alter(array &$links, ViewExecutable $vi ...@@ -627,7 +627,7 @@ function hook_views_ui_display_top_links_alter(array &$links, ViewExecutable $vi
* @see views_invalidate_cache() * @see views_invalidate_cache()
*/ */
function hook_views_invalidate_cache() { function hook_views_invalidate_cache() {
cache('mymodule')->invalidateTags(array('views' => TRUE)); \Drupal\Core\Cache\Cache::invalidateTags(array('views' => TRUE));
} }
/** /**
......
...@@ -63,6 +63,17 @@ protected function setUp() { ...@@ -63,6 +63,17 @@ protected function setUp() {
$this->lock = $this->getMock('Drupal\Core\Lock\LockBackendInterface'); $this->lock = $this->getMock('Drupal\Core\Lock\LockBackendInterface');
$this->cid = $this->randomName(); $this->cid = $this->randomName();
$this->collector = new CacheCollectorHelper($this->cid, $this->cache, $this->lock); $this->collector = new CacheCollectorHelper($this->cid, $this->cache, $this->lock);
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
$container->expects($this->any())
->method('getParameter')
->with('cache_bins')
->will($this->returnValue(array('cache.test' => 'test')));
$container->expects($this->any())
->method('get')
->with('cache.test')
->will($this->returnValue($this->cache));
\Drupal::setContainer($container);
} }
......
...@@ -124,6 +124,7 @@ protected function setUp() { ...@@ -124,6 +124,7 @@ protected function setUp() {
$this->container = new ContainerBuilder(); $this->container = new ContainerBuilder();
$this->container->set('cache.cache', $this->cache); $this->container->set('cache.cache', $this->cache);
$this->container->setParameter('cache_bins', array('cache.cache' => 'cache'));
$this->container->set('module_handler', $this->moduleHandler); $this->container->set('module_handler', $this->moduleHandler);
$this->container->set('form_builder', $this->formBuilder); $this->container->set('form_builder', $this->formBuilder);
\Drupal::setContainer($this->container); \Drupal::setContainer($this->container);
......
...@@ -105,6 +105,17 @@ protected function setUp() { ...@@ -105,6 +105,17 @@ protected function setUp() {
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->themeHandler = new TestThemeHandler($this->configFactory, $this->moduleHandler, $this->cacheBackend, $this->infoParser, $this->configInstaller, $this->routeBuilder, $this->systemListingInfo); $this->themeHandler = new TestThemeHandler($this->configFactory, $this->moduleHandler, $this->cacheBackend, $this->infoParser, $this->configInstaller, $this->routeBuilder, $this->systemListingInfo);
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
$container->expects($this->any())
->method('getParameter')
->with('cache_bins')
->will($this->returnValue(array('cache.test' => 'test')));
$container->expects($this->any())
->method('get')
->with('cache.test')
->will($this->returnValue($this->cacheBackend));
\Drupal::setContainer($container);
} }
/** /**
......
...@@ -172,6 +172,17 @@ public function testCacheClearWithTags() { ...@@ -172,6 +172,17 @@ public function testCacheClearWithTags() {
->expects($this->never()) ->expects($this->never())
->method('deleteMultiple'); ->method('deleteMultiple');
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
$container->expects($this->any())