You are here

public function ConfigurationHandlerBaseTestCase::testExportToDataStore in Configuration Management 7.2

Import a configuration from the ActiveStore to the DataStore.

Configuration to import should be defined in exportConfig().

File

tests/handlers/ConfigurationHandlerBaseTestCase.test, line 77
Tests for Configuration Management: Base Class

Class

ConfigurationHandlerBaseTestCase
Base class for functional tests for configuration management.

Code

public function testExportToDataStore() {
  $this
    ->createConfigToExport();
  $configToExport = $this
    ->configToExport();
  $results = ConfigurationManagement::exportToDataStore($configToExport, $this
    ->exportDependencies(), $this
    ->exportOptionals());
  $exported = $results
    ->getInfo('exported');
  foreach ($configToExport as $config) {
    $this
      ->assertTrue(in_array($config, $exported), "Configuration for {$config} was exported.");
    $file_for_config = $this->datastore_path . '/' . $config . '.inc';
    $this
      ->assertTrue(file_exists($file_for_config), "The file that storages the {$config} was created.");
  }
  if ($this
    ->exportDependencies()) {
    $dependencies = $this
      ->dependenciesToExport();
    foreach ($dependencies as $config) {
      $this
        ->assertTrue(in_array($config, $exported), "Dependency configuration for {$config} was exported.");
      $file_for_config = $this->datastore_path . '/' . $config . '.inc';
      $this
        ->assertTrue(file_exists($file_for_config), "The file that storages the dependency {$config} was created.");
    }
  }
  if ($this
    ->exportOptionals()) {
    $optionals = $this
      ->optionalsToExport();
    foreach ($optionals as $config) {
      $this
        ->assertTrue(in_array($config, $exported), "Optional configuration for {$config} was exported.");
      $file_for_config = $this->datastore_path . '/' . $config . '.inc';
      $this
        ->assertTrue(file_exists($file_for_config), "The file that storages the optional {$config} was created.");
    }
  }
  $this
    ->extraChecksOnExport();
}