You are here

protected function ConfigTestTrait::configImporter in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/ConfigTestTrait.php \Drupal\Tests\ConfigTestTrait::configImporter()
  2. 9 core/tests/Drupal/Tests/ConfigTestTrait.php \Drupal\Tests\ConfigTestTrait::configImporter()

Returns a ConfigImporter object to import test configuration.

Return value

\Drupal\Core\Config\ConfigImporter The config importer object.

25 calls to ConfigTestTrait::configImporter()
ConfigEntityImportTest::assertConfigUpdateImport in core/modules/system/tests/src/Kernel/Entity/ConfigEntityImportTest.php
Asserts that config entities are updated during import.
ConfigImporterTest::testCustomStep in core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php
Tests that the isConfigSyncing flag is set correctly during a custom step.
ConfigImporterTest::testDeleted in core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php
Tests deletion of configuration during import.
ConfigImporterTest::testEmptyImportFails in core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php
Tests that trying to import from an empty sync configuration directory fails.
ConfigImporterTest::testInstallProfile in core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php
Tests install profile validation during configuration import.

... See full list

File

core/tests/Drupal/Tests/ConfigTestTrait.php, line 23

Class

ConfigTestTrait
Provides helper methods to deal with config system objects in tests.

Namespace

Drupal\Tests

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->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'));
  }

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