Loading core/tests/Drupal/KernelTests/KernelTestBase.php +8 −11 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ use Drupal\Core\DrupalKernel; use Drupal\Core\Entity\Sql\SqlEntityStorageInterface; use Drupal\Core\Extension\ExtensionDiscovery; use Drupal\Core\KeyValueStore\KeyValueMemoryFactory; use Drupal\Core\Language\Language; use Drupal\Core\Site\Settings; use Drupal\Core\Test\TestDatabase; Loading Loading @@ -199,7 +200,7 @@ abstract class KernelTestBase extends TestCase implements ServiceProviderInterfa * * @var \Drupal\Core\KeyValueStore\KeyValueMemoryFactory */ protected $keyValue; protected KeyValueMemoryFactory $keyValue; /** * The app root. Loading Loading @@ -550,18 +551,14 @@ public function register(ContainerBuilder $container) { ->register('lock', 'Drupal\Core\Lock\NullLockBackend'); $container ->register('cache_factory', 'Drupal\Core\Cache\MemoryBackendFactory'); $container ->register('keyvalue.memory', 'Drupal\Core\KeyValueStore\KeyValueMemoryFactory'); $container ->setAlias('keyvalue', 'keyvalue.memory'); // Must persist container rebuilds, or all data would vanish otherwise. if ($this->keyValue !== NULL) { $container->set('keyvalue.memory', $this->keyValue); } else { $this->keyValue = $container->get('keyvalue.memory'); // Use memory for key value storages to avoid database queries. Store the // key value factory on the test object so that key value storages persist // container rebuilds, otherwise all state data would vanish. if (!isset($this->keyValue)) { $this->keyValue = new KeyValueMemoryFactory(); } $container->set('keyvalue', $this->keyValue); // Set the default language on the minimal container. $container->setParameter('language.default_values', Language::$defaultValues); Loading Loading
core/tests/Drupal/KernelTests/KernelTestBase.php +8 −11 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ use Drupal\Core\DrupalKernel; use Drupal\Core\Entity\Sql\SqlEntityStorageInterface; use Drupal\Core\Extension\ExtensionDiscovery; use Drupal\Core\KeyValueStore\KeyValueMemoryFactory; use Drupal\Core\Language\Language; use Drupal\Core\Site\Settings; use Drupal\Core\Test\TestDatabase; Loading Loading @@ -199,7 +200,7 @@ abstract class KernelTestBase extends TestCase implements ServiceProviderInterfa * * @var \Drupal\Core\KeyValueStore\KeyValueMemoryFactory */ protected $keyValue; protected KeyValueMemoryFactory $keyValue; /** * The app root. Loading Loading @@ -550,18 +551,14 @@ public function register(ContainerBuilder $container) { ->register('lock', 'Drupal\Core\Lock\NullLockBackend'); $container ->register('cache_factory', 'Drupal\Core\Cache\MemoryBackendFactory'); $container ->register('keyvalue.memory', 'Drupal\Core\KeyValueStore\KeyValueMemoryFactory'); $container ->setAlias('keyvalue', 'keyvalue.memory'); // Must persist container rebuilds, or all data would vanish otherwise. if ($this->keyValue !== NULL) { $container->set('keyvalue.memory', $this->keyValue); } else { $this->keyValue = $container->get('keyvalue.memory'); // Use memory for key value storages to avoid database queries. Store the // key value factory on the test object so that key value storages persist // container rebuilds, otherwise all state data would vanish. if (!isset($this->keyValue)) { $this->keyValue = new KeyValueMemoryFactory(); } $container->set('keyvalue', $this->keyValue); // Set the default language on the minimal container. $container->setParameter('language.default_values', Language::$defaultValues); Loading