1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- namespace Drupal\Tests;
- use Drupal\Core\Config\ConfigImporter;
- use Drupal\Core\Config\StorageComparer;
- use Drupal\Core\Config\StorageInterface;
- trait ConfigTestTrait {
-
- protected function configImporter() {
- if (!$this->configImporter) {
-
- $storage_comparer = new StorageComparer(
- $this->container->get('config.storage.sync'),
- $this->container->get('config.storage'),
- $this->container->get('config.manager')
- );
- $this->configImporter = new ConfigImporter(
- $storage_comparer,
- $this->container->get('event_dispatcher'),
- $this->container->get('config.manager'),
- $this->container->get('lock'),
- $this->container->get('config.typed'),
- $this->container->get('module_handler'),
- $this->container->get('module_installer'),
- $this->container->get('theme_handler'),
- $this->container->get('string_translation')
- );
- }
-
- return $this->configImporter->reset();
- }
-
- protected function copyConfig(StorageInterface $source_storage, StorageInterface $target_storage) {
- $target_storage->deleteAll();
- foreach ($source_storage->listAll() as $name) {
- $target_storage->write($name, $source_storage->read($name));
- }
- }
- }
|