diff --git a/core/lib/Drupal/Component/FileCache/FileCache.php b/core/lib/Drupal/Component/FileCache/FileCache.php index 1f26bbb..5fcdaa9 100644 --- a/core/lib/Drupal/Component/FileCache/FileCache.php +++ b/core/lib/Drupal/Component/FileCache/FileCache.php @@ -154,7 +154,7 @@ public function delete($filepath) { } /** - * {@inheritdoc} + * Resets the static cache. */ public static function reset() { static::$cached = []; diff --git a/core/lib/Drupal/Component/FileCache/FileCacheInterface.php b/core/lib/Drupal/Component/FileCache/FileCacheInterface.php index b86cd13..e347783 100644 --- a/core/lib/Drupal/Component/FileCache/FileCacheInterface.php +++ b/core/lib/Drupal/Component/FileCache/FileCacheInterface.php @@ -61,9 +61,4 @@ public function set($filepath, $data); */ public function delete($filepath); - /** - * Resets the static cache. - */ - public static function reset(); - } diff --git a/core/lib/Drupal/Component/FileCache/NullFileCache.php b/core/lib/Drupal/Component/FileCache/NullFileCache.php index 1025749..84c64cc 100644 --- a/core/lib/Drupal/Component/FileCache/NullFileCache.php +++ b/core/lib/Drupal/Component/FileCache/NullFileCache.php @@ -55,10 +55,4 @@ public function set($filepath, $data) { public function delete($filepath) { } - /** - * {@inheritdoc} - */ - public static function reset() { - } - } diff --git a/core/tests/Drupal/KernelTests/KernelTestBase.php b/core/tests/Drupal/KernelTests/KernelTestBase.php index 4be89b4..a584cce 100644 --- a/core/tests/Drupal/KernelTests/KernelTestBase.php +++ b/core/tests/Drupal/KernelTests/KernelTestBase.php @@ -7,6 +7,7 @@ namespace Drupal\KernelTests; +use Drupal\Component\FileCache\ApcuFileCacheBackend; use Drupal\Component\FileCache\FileCache; use Drupal\Component\FileCache\FileCacheFactory; use Drupal\Component\Utility\Html; @@ -214,6 +215,7 @@ protected function setUp() { parent::setUp(); $this->root = static::getDrupalRoot(); + $this->initFileCache(); $this->bootEnvironment(); $this->bootKernel(); } @@ -493,14 +495,14 @@ protected function initFileCache() { // Provide a default configuration, if not set. if (!isset($configuration['default'])) { $configuration['default'] = [ - 'class' => '\Drupal\Component\FileCache\FileCache', + 'class' => FileCache::class, 'cache_backend_class' => NULL, 'cache_backend_configuration' => [], ]; // @todo Use extension_loaded('apcu') for non-testbot // https://www.drupal.org/node/2447753. if (function_exists('apc_fetch')) { - $configuration['default']['cache_backend_class'] = '\Drupal\Component\FileCache\ApcuFileCacheBackend'; + $configuration['default']['cache_backend_class'] = ApcuFileCacheBackend::class; } } FileCacheFactory::setConfiguration($configuration); @@ -523,8 +525,6 @@ protected function initFileCache() { * @see \Drupal\Core\Extension\ModuleHandler::add() */ private function getExtensionsForModules(array $modules) { - $this->initFileCache(); - $extensions = array(); $discovery = new ExtensionDiscovery($this->root); $discovery->setProfileDirectories(array());