function ConfigImporterTest::setUp

Sets up Drupal unit test environment.

Overrides DrupalUnitTestBase::setUp

See also

DrupalUnitTestBase::$modules

DrupalUnitTestBase

File

drupal/core/modules/config/lib/Drupal/config/Tests/ConfigImporterTest.php, line 42
Contains \Drupal\config\Tests\ConfigImporterTest.

Class

ConfigImporterTest
Tests importing configuration from files into active configuration.

Namespace

Drupal\config\Tests

Code

function setUp() {
  parent::setUp();
  $this
    ->installSchema('system', 'config_snapshot');
  config_install_default_config('module', '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']);

  // Set up the ConfigImporter object for testing.
  $config_comparer = new StorageComparer($this->container
    ->get('config.storage.staging'), $this->container
    ->get('config.storage'));
  $this->configImporter = new ConfigImporter($config_comparer
    ->createChangelist(), $this->container
    ->get('event_dispatcher'), $this->container
    ->get('config.factory'), $this->container
    ->get('plugin.manager.entity'), $this->container
    ->get('lock'));
  $this
    ->copyConfig($this->container
    ->get('config.storage'), $this->container
    ->get('config.storage.staging'));
}