function ConfigTestTrait::configImporter

Returns a ConfigImporter object to import test configuration.

Return value

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

18 calls to ConfigTestTrait::configImporter()
ConfigImporterMissingContentTest::testMissingBlockContent in core/tests/Drupal/KernelTests/Core/Config/ConfigImporterMissingContentTest.php
Tests the missing content, config import and the block plugin manager.
ConfigImporterTest::testDeleted in core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php
Tests deletion of configuration during import.
ConfigImporterTest::testInstallBaseAndSubThemes in core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php
Tests installing a base themes and sub themes during configuration import.
ConfigImporterTest::testInstallProfile in core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php
Tests install profile validation during configuration import.
ConfigImporterTest::testInstallProfileMisMatch 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 25

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 = $this->container
      ->get(ConfigImporterFactory::class)
      ->get($storage_comparer);
  }
  // Always recalculate the changelist when called.
  return $this->configImporter
    ->reset();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.