diff -u b/core/modules/system/lib/Drupal/system/Tests/Cache/DatabaseBackendUnitTest.php b/core/modules/system/lib/Drupal/system/Tests/Cache/DatabaseBackendUnitTest.php --- b/core/modules/system/lib/Drupal/system/Tests/Cache/DatabaseBackendUnitTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Cache/DatabaseBackendUnitTest.php @@ -15,6 +15,13 @@ */ class DatabaseBackendUnitTest extends GenericCacheBackendUnitTestBase { + /** + * Modules to enable. + * + * @var array + */ + public static $modules = array('system'); + public static function getInfo() { return array( 'name' => 'Database backend', @@ -37,12 +44,7 @@ * Installs system schema. */ public function setUpCacheBackend() { - // Calling drupal_install_schema() entails a call to module_invoke, for which - // we need a ModuleHandler. Register one to the container. - // @todo Use DrupalUnitTestBase. - $this->container->register('module_handler', 'Drupal\Core\Extension\ModuleHandler'); - - drupal_install_schema('system'); + $this->installSchema('system', array('cache', 'cache_page', 'cache_tags', 'cache_path', 'cache_bootstrap')); } /** diff -u b/core/modules/system/system.module b/core/modules/system/system.module --- b/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -3532,10 +3532,9 @@ Drupal::service('flood')->garbageCollection(); module_invoke_all('cache_flush'); - $bins = Cache::getBins(); - array_walk($bins, function (CacheBackendInterface $cache_backend) { + foreach (Cache::getBins() as $cache_backend) { $cache_backend->deleteExpired(); - }); + } // Cleanup the batch table and the queue for failed batches. db_delete('batch') only in patch2: unchanged: --- a/core/modules/system/lib/Drupal/system/Tests/Cache/GenericCacheBackendUnitTestBase.php +++ b/core/modules/system/lib/Drupal/system/Tests/Cache/GenericCacheBackendUnitTestBase.php @@ -8,7 +8,7 @@ namespace Drupal\system\Tests\Cache; use Drupal\Core\Cache\CacheBackendInterface; -use Drupal\simpletest\UnitTestBase; +use Drupal\simpletest\DrupalUnitTestBase; use stdClass; @@ -22,7 +22,7 @@ * @see DatabaseBackendUnitTestCase * For a full working implementation. */ -abstract class GenericCacheBackendUnitTestBase extends UnitTestBase { +abstract class GenericCacheBackendUnitTestBase extends DrupalUnitTestBase { /** * Array of objects implementing Drupal\Core\Cache\CacheBackendInterface.