ConfigTestTrait.php in Drupal 8
File
core/tests/Drupal/Tests/ConfigTestTrait.php
View source
<?php
namespace Drupal\Tests;
use Drupal\Core\Config\ConfigImporter;
use Drupal\Core\Config\StorageComparer;
use Drupal\Core\Config\StorageCopyTrait;
use Drupal\Core\Config\StorageInterface;
trait ConfigTestTrait {
use StorageCopyTrait;
protected function configImporter() {
if (!$this->configImporter) {
$storage_comparer = new StorageComparer($this->container
->get('config.storage.sync'), $this->container
->get('config.storage'));
$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'), $this->container
->get('extension.list.module'));
}
return $this->configImporter
->reset();
}
protected function copyConfig(StorageInterface $source_storage, StorageInterface $target_storage) {
static::replaceStorageContents($source_storage, $target_storage);
}
}
Traits
Name |
Description |
ConfigTestTrait |
Provides helper methods to deal with config system objects in tests. |