You are here

protected function ConfigImporterMissingContentTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Config/ConfigImporterMissingContentTest.php \Drupal\KernelTests\Core\Config\ConfigImporterMissingContentTest::setUp()
  2. 10 core/tests/Drupal/KernelTests/Core/Config/ConfigImporterMissingContentTest.php \Drupal\KernelTests\Core\Config\ConfigImporterMissingContentTest::setUp()

Overrides KernelTestBase::setUp

File

core/tests/Drupal/KernelTests/Core/Config/ConfigImporterMissingContentTest.php, line 37

Class

ConfigImporterMissingContentTest
Tests importing configuration which has missing content dependencies.

Namespace

Drupal\KernelTests\Core\Config

Code

protected function setUp() : void {
  parent::setUp();
  $this
    ->installSchema('system', 'sequences');
  $this
    ->installEntitySchema('entity_test');
  $this
    ->installEntitySchema('user');
  $this
    ->installConfig([
    'system',
    'config_test',
  ]);

  // Installing config_test's default configuration pollutes the global
  // variable being used for recording hook invocations by this test already,
  // so it has to be cleared out manually.
  unset($GLOBALS['hook_config_test']);
  $this
    ->copyConfig($this->container
    ->get('config.storage'), $this->container
    ->get('config.storage.sync'));

  // 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
    ->createChangelist(), $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'));
}