diff --git a/core/includes/menu.inc b/core/includes/menu.inc index c41e11e59fa260bfb5d06afc97e806f86b255e2b..d0432dd44d7b0a444f1b1259a24e784364c7e948 100644 --- a/core/includes/menu.inc +++ b/core/includes/menu.inc @@ -7,6 +7,7 @@ use Drupal\Component\Utility\NestedArray; use Drupal\Component\Utility\String; +use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Language\Language; use Drupal\Core\Routing\RequestHelper; @@ -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')) { menu_router_rebuild(); \Drupal::service('router.builder')->rebuild(); - \Drupal::cache()->deleteTags(array('local_task' => 1)); + Cache::deleteTags(array('local_task' => 1)); } $original_map = arg(NULL, $path); @@ -2480,7 +2481,7 @@ function menu_get_active_title() { * Clears the cached cached data for a single named menu. */ 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. menu_reset_static_cache(); } diff --git a/core/includes/schema.inc b/core/includes/schema.inc index d0fd30b702dc0e895fbbedde41e0385a3f045ca4..83ce4838f8e36995d4a14649c7ca65072a2644fa 100644 --- a/core/includes/schema.inc +++ b/core/includes/schema.inc @@ -5,6 +5,7 @@ * Schema API handling functions. */ +use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Database\Database; use Drupal\Core\Utility\SchemaCache; @@ -94,7 +95,7 @@ function drupal_get_complete_schema($rebuild = FALSE) { drupal_alter('schema', $schema); if ($rebuild) { - cache()->deleteTags(array('schema' => TRUE)); + Cache::deleteTags(array('schema' => TRUE)); } // If the schema is empty, avoid saving it: some database engines require // the schema to perform queries, and this could lead to infinite loops. diff --git a/core/lib/Drupal/Core/Cache/CacheCollector.php b/core/lib/Drupal/Core/Cache/CacheCollector.php index 21d54878ff334edd78a1852955d30d3c8c1c361f..aa1fff22e165198ead34d6498d8976b5dde3048c 100644 --- a/core/lib/Drupal/Core/Cache/CacheCollector.php +++ b/core/lib/Drupal/Core/Cache/CacheCollector.php @@ -268,7 +268,7 @@ public function reset() { public function clear() { $this->reset(); if ($this->tags) { - $this->cache->deleteTags($this->tags); + Cache::deleteTags($this->tags); } else { $this->cache->delete($this->cid); diff --git a/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php index db65b3d68d94912e5c04e6d2173542e991008c50..6221633ec46f0135cfb109ef1168f6ddcee1e450 100644 --- a/core/lib/Drupal/Core/Entity/EntityManager.php +++ b/core/lib/Drupal/Core/Entity/EntityManager.php @@ -13,6 +13,7 @@ use Drupal\Component\Utility\NestedArray; use Drupal\Component\Utility\String; use Drupal\Core\Field\FieldDefinition; +use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Language\LanguageManager; @@ -395,7 +396,7 @@ public function getFieldDefinitionsByConstraints($entity_type, array $constraint public function clearCachedFieldDefinitions() { unset($this->entityFieldInfo); unset($this->fieldDefinitions); - $this->cache->deleteTags(array('entity_field_info' => TRUE)); + Cache::deleteTags(array('entity_field_info' => TRUE)); } /** diff --git a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php index 81e6c387f4f3d09a23aea2b7b734209978924eae..fb19c4eae80ee3bdcc4a6deccba0f5baf8baf63b 100644 --- a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php +++ b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php @@ -7,6 +7,7 @@ namespace Drupal\Core\Entity; +use Drupal\Core\Cache\Cache; use Drupal\Core\Entity\Display\EntityViewDisplayInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Language\Language; @@ -261,10 +262,10 @@ public function resetCache(array $entities = NULL) { $tags[$this->entityType][$id] = $id; $tags[$this->entityType . '_view_' . $entity->bundle()] = TRUE; } - \Drupal::cache($this->cacheBin)->deleteTags($tags); + Cache::deleteTags($tags); } else { - \Drupal::cache($this->cacheBin)->deleteTags(array($this->entityType . '_view' => TRUE)); + Cache::deleteTags(array($this->entityType . '_view' => TRUE)); } } diff --git a/core/lib/Drupal/Core/Extension/ThemeHandler.php b/core/lib/Drupal/Core/Extension/ThemeHandler.php index fbd42c59b48646b5e92b16f1433323f6c4ccb736..c25dcd9627520365d33446dc5d7280eb47d54970 100644 --- a/core/lib/Drupal/Core/Extension/ThemeHandler.php +++ b/core/lib/Drupal/Core/Extension/ThemeHandler.php @@ -8,6 +8,7 @@ namespace Drupal\Core\Extension; use Drupal\Component\Utility\String; +use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Config\ConfigFactory; use Drupal\Core\Config\ConfigInstallerInterface; @@ -465,7 +466,7 @@ protected function resetSystem() { // @todo It feels wrong to have the requirement to clear the local tasks // cache here. - $this->cacheBackend->deleteTags(array('local_task' => 1)); + Cache::deleteTags(array('local_task' => 1)); $this->themeRegistryRebuild(); } diff --git a/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php b/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php index 712c5eec4b6cbed6cbebd9aff50d3940d7955e4e..32647355bb8842127d7bee8bbef9405da9ad3dcb 100644 --- a/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php +++ b/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php @@ -8,6 +8,7 @@ namespace Drupal\Core\Plugin; use Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface; +use Drupal\Core\Cache\Cache; use Drupal\Core\Plugin\Discovery\ContainerDerivativeDiscoveryDecorator; use Drupal\Component\Plugin\PluginManagerBase; use Drupal\Component\Plugin\PluginManagerInterface; @@ -184,7 +185,7 @@ public function clearCachedDefinitions() { if ($this->cacheBackend) { if ($this->cacheTags) { // Use the cache tags to clear the cache. - $this->cacheBackend->deleteTags($this->cacheTags); + Cache::deleteTags($this->cacheTags); } elseif ($this->languageManager) { $cache_keys = array(); diff --git a/core/lib/Drupal/Core/Plugin/Discovery/CacheDecorator.php b/core/lib/Drupal/Core/Plugin/Discovery/CacheDecorator.php index 15235f987e4808f268ea681820c15b2f32b3f7ca..f5d9a8446689e1acbb3df0aa2a8fdfa1d905d5fe 100644 --- a/core/lib/Drupal/Core/Plugin/Discovery/CacheDecorator.php +++ b/core/lib/Drupal/Core/Plugin/Discovery/CacheDecorator.php @@ -9,6 +9,7 @@ use Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface; use Drupal\Component\Plugin\Discovery\DiscoveryInterface; +use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\CacheBackendInterface; /** @@ -157,7 +158,7 @@ protected function setCachedDefinitions($definitions) { public function clearCachedDefinitions() { // If there are any cache tags, clear cache based on those. if (!empty($this->cacheTags)) { - $this->cache($this->cacheBin)->deleteTags($this->cacheTags); + Cache::deleteTags($this->cacheTags); } // Otherwise, just delete the specified cache key. else if (isset($this->cacheKey)) { diff --git a/core/lib/Drupal/Core/Theme/Registry.php b/core/lib/Drupal/Core/Theme/Registry.php index 3c5ada7ac0366b8a064d641f1382bcdd7859cba8..cbe6643928d901fa7733cf1ba28ddd97487e2d27 100644 --- a/core/lib/Drupal/Core/Theme/Registry.php +++ b/core/lib/Drupal/Core/Theme/Registry.php @@ -7,6 +7,7 @@ namespace Drupal\Core\Theme; +use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\DestructableInterface; use Drupal\Core\Extension\ModuleHandlerInterface; @@ -550,7 +551,7 @@ public function reset() { $this->runtimeRegistry = NULL; $this->registry = NULL; - $this->cache->invalidateTags(array('theme_registry' => TRUE)); + Cache::invalidateTags(array('theme_registry' => TRUE)); return $this; } diff --git a/core/modules/field/lib/Drupal/field/FieldInfo.php b/core/modules/field/lib/Drupal/field/FieldInfo.php index 4df7ab8949035b12e62d9dc1eda4792dfcde940a..e458c0f80438d833ca36f305ebb50da6daf4f348 100644 --- a/core/modules/field/lib/Drupal/field/FieldInfo.php +++ b/core/modules/field/lib/Drupal/field/FieldInfo.php @@ -7,6 +7,7 @@ namespace Drupal\field; +use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Config\ConfigFactory; use Drupal\Core\Field\FieldTypePluginManager; @@ -160,7 +161,7 @@ public function flush() { $this->bundleExtraFields = array(); - $this->cacheBackend->deleteTags(array('field_info' => TRUE)); + Cache::deleteTags(array('field_info' => TRUE)); } /** diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module index f206e621d3f5a2e49f26bdd9575f5e4bd7c3bbf8..ecd4e58fc8e45d8e4826959db04312a583c05453 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -6,6 +6,7 @@ */ use Drupal\Component\Utility\String; +use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Language\Language; use Drupal\Core\Session\AccountInterface; @@ -229,7 +230,7 @@ function filter_formats(AccountInterface $account = NULL) { * @see filter_formats() */ function filter_formats_reset() { - cache()->deleteTags(array('filter_formats' => TRUE)); + Cache::deleteTags(array('filter_formats' => TRUE)); drupal_static_reset('filter_formats'); } diff --git a/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php b/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php index 715820b53beef2131c48ba2cf61a7d6ecf7d7910..fa0d2cc67091bd9491f369ecffa5e62fb61b0f9c 100644 --- a/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php +++ b/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php @@ -7,6 +7,7 @@ namespace Drupal\filter\Entity; +use Drupal\Core\Cache\Cache; use Drupal\Core\Config\Entity\ConfigEntityBase; use Drupal\Core\Entity\EntityStorageControllerInterface; use Drupal\filter\FilterFormatInterface; @@ -183,7 +184,7 @@ public function disable() { // Clear the filter cache whenever a text format is disabled. filter_formats_reset(); - cache('filter')->deleteTags(array('filter_format' => $this->format)); + Cache::deleteTags(array('filter_format' => $this->format)); return $this; } @@ -220,7 +221,7 @@ public function postSave(EntityStorageControllerInterface $storage_controller, $ if ($update) { // 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 { // Default configuration of modules and installation profiles is allowed diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleTranslationUiTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleTranslationUiTest.php index 91e4c8146cda3a9958751b07072af32dbd01399f..c3fc74e094b4b07dbce4ac241a806a6bdbfae53f 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleTranslationUiTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleTranslationUiTest.php @@ -141,7 +141,7 @@ function testStringTranslation() { $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 - // cache()->deleteTags() on the tested side. + // Cache::deleteTags() on the tested side. drupal_static_reset('Drupal\Core\Cache\CacheBackendInterface::tagCache'); $this->assertTrue($name != $translation && t($name, array(), array('langcode' => $langcode)) == $translation, 't() works for non-English.'); diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module index 3c5dfedb4816bb58f5afb23c5a299e2ab694877f..7a7574abaceea6b047d3f98c909058f735102653 100644 --- a/core/modules/locale/locale.module +++ b/core/modules/locale/locale.module @@ -10,6 +10,7 @@ * object files are supported. */ +use Drupal\Core\Cache\Cache; use Drupal\Core\Language\Language; use Drupal\Component\Utility\Crypt; @@ -1122,7 +1123,7 @@ function _locale_refresh_translations($langcodes, $lids = array()) { } } // Clear locale cache. - cache()->deleteTags(array('locale' => TRUE)); + Cache::deleteTags(array('locale' => TRUE)); } /** diff --git a/core/modules/node/lib/Drupal/node/Entity/NodeType.php b/core/modules/node/lib/Drupal/node/Entity/NodeType.php index cec3461e004c7145cd7a5a43e39a2613be79238b..99c5267c5573675013399891c863ebaec672142d 100644 --- a/core/modules/node/lib/Drupal/node/Entity/NodeType.php +++ b/core/modules/node/lib/Drupal/node/Entity/NodeType.php @@ -8,6 +8,7 @@ namespace Drupal\node\Entity; use Drupal\Component\Utility\NestedArray; +use Drupal\Core\Cache\Cache; use Drupal\Core\Config\Entity\ConfigEntityBase; use Drupal\Core\Entity\EntityStorageControllerInterface; use Drupal\node\NodeTypeInterface; @@ -164,7 +165,7 @@ public function postSave(EntityStorageControllerInterface $storage_controller, $ if (!$update) { // 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()); @@ -177,7 +178,7 @@ public function postSave(EntityStorageControllerInterface $storage_controller, $ } elseif ($this->getOriginalId() != $this->id()) { // 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()); if ($update_count) { @@ -193,7 +194,7 @@ public function postSave(EntityStorageControllerInterface $storage_controller, $ } else { // Invalidate the cache tag of the updated node type only. - cache()->invalidateTags(array('node_type' => $this->id())); + Cache::invalidateTags(array('node_type' => $this->id())); } } diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index 697f8c7381c023943b01072f0e6abbbcd0f006c6..bd794be187ec17de93ce9df24e27c6a3262847c1 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -5,6 +5,7 @@ * Admin page callbacks for the system module. */ +use Drupal\Core\Cache\Cache; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; @@ -37,7 +38,7 @@ function system_theme_default() { // enabled. \Drupal::service('router.builder')->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: // a value of 0 means the admin theme is set to be the default theme. diff --git a/core/modules/toolbar/lib/Drupal/toolbar/Tests/ToolbarAdminMenuTest.php b/core/modules/toolbar/lib/Drupal/toolbar/Tests/ToolbarAdminMenuTest.php index 8ccec8ec79006e507ee9047d28e31fed16459002..b3f08ccda3e939debaf73767e49e41887fde72eb 100644 --- a/core/modules/toolbar/lib/Drupal/toolbar/Tests/ToolbarAdminMenuTest.php +++ b/core/modules/toolbar/lib/Drupal/toolbar/Tests/ToolbarAdminMenuTest.php @@ -7,6 +7,7 @@ namespace Drupal\toolbar\Tests; +use Drupal\Core\Cache\Cache; use Drupal\simpletest\WebTestBase; /** @@ -284,7 +285,7 @@ function testCacheClearByCacheTag() { // Log in admin_user and clear the caches for this user using a tag. $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 // language "en". diff --git a/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module index 096c4894634e69d706072955ed8317e7ba6618af..86ef5ee5d88512046a253a0a2675749f7d1fc87c 100644 --- a/core/modules/toolbar/toolbar.module +++ b/core/modules/toolbar/toolbar.module @@ -5,6 +5,7 @@ * Administration toolbar for quick access to top level administration items. */ +use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Language\Language; use Drupal\Core\Template\Attribute; @@ -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, // associated with this user. if (isset($uid)) { - $cache->deleteTags(array('user' => array($uid))); + Cache::deleteTags(array('user' => array($uid))); } else { $cache->deleteAll(); } diff --git a/core/modules/tour/tour.api.php b/core/modules/tour/tour.api.php index db0312f3b9e57f5664770a55a5949eec4aa73511..6537cc7c19ac7b6525207e4838f9a9a29a84ba4f 100644 --- a/core/modules/tour/tour.api.php +++ b/core/modules/tour/tour.api.php @@ -73,7 +73,7 @@ function hook_tour_presave($entity) { */ function hook_tour_insert($entity) { \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) { */ function hook_tour_update($entity) { \Drupal::service('plugin.manager.tour.tip')->clearCachedDefinitions(); - cache('cache_tour')->deleteTags(array('tour_items')); + \Drupal\Core\Cache\Cache::deleteTags(array('tour_items')); } diff --git a/core/modules/views/views.api.php b/core/modules/views/views.api.php index 52816e2c42f001df8d82329816a5dc2fbf44db81..4ba2a3c01b553221efdeb6df73b27d7541721403 100644 --- a/core/modules/views/views.api.php +++ b/core/modules/views/views.api.php @@ -627,7 +627,7 @@ function hook_views_ui_display_top_links_alter(array &$links, ViewExecutable $vi * @see views_invalidate_cache() */ function hook_views_invalidate_cache() { - cache('mymodule')->invalidateTags(array('views' => TRUE)); + \Drupal\Core\Cache\Cache::invalidateTags(array('views' => TRUE)); } /** diff --git a/core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php b/core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php index 702c7c7dd18711bfd2e22c22a833273a58915875..7885679d9905bdb955319c7058296fbee59e8a7d 100644 --- a/core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php +++ b/core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php @@ -63,6 +63,17 @@ protected function setUp() { $this->lock = $this->getMock('Drupal\Core\Lock\LockBackendInterface'); $this->cid = $this->randomName(); $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); } diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php index 8762ff287de5f86b66f7bb306fd3a199bdfb45b4..81dc34daadea9b53e242bb4a04193671764a0fa3 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php @@ -124,6 +124,7 @@ protected function setUp() { $this->container = new ContainerBuilder(); $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('form_builder', $this->formBuilder); \Drupal::setContainer($this->container); diff --git a/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php b/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php index 717cee57194a4b7e5debc8a80779ddc25431b394..25901c18abd4d62da52744e775818abe71970352 100644 --- a/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php +++ b/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php @@ -105,6 +105,17 @@ protected function setUp() { ->disableOriginalConstructor() ->getMock(); $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); } /** diff --git a/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php b/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php index ec84708fa8822c9d0561d15ae05995662ee59616..e0b9b939845f3d5bd83ffdd35b526bd95a93fcb6 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php @@ -172,6 +172,17 @@ public function testCacheClearWithTags() { ->expects($this->never()) ->method('deleteMultiple'); + $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($cache_backend)); + \Drupal::setContainer($container); + $language = new Language(array('id' => 'en')); $language_manager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface'); $language_manager->expects($this->once())