You are here

protected function KernelTestBase::configImporter in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::configImporter()

Returns a ConfigImporter object to import test configuration.

@todo Move into Config-specific test base class.

Return value

\Drupal\Core\Config\ConfigImporter

File

core/tests/Drupal/KernelTests/KernelTestBase.php, line 942
Contains \Drupal\KernelTests\KernelTestBase.

Class

KernelTestBase
Base class for functional integration tests.

Namespace

Drupal\KernelTests

Code

protected function configImporter() {
  if (!$this->configImporter) {

    // Set up the ConfigImporter object for testing.
    $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'));
  }

  // Always recalculate the changelist when called.
  return $this->configImporter
    ->reset();
}