public function ConfigurationHandlerBaseTestCase::testImportToActiveStore in Configuration Management 7.2
Import a configuration from the DataStore into the ActiveStore.
Configuration to import should be defined in importConfig().
File
- tests/
handlers/ ConfigurationHandlerBaseTestCase.test, line 41 - Tests for Configuration Management: Base Class
Class
- ConfigurationHandlerBaseTestCase
- Base class for functional tests for configuration management.
Code
public function testImportToActiveStore() {
// Change the path from where the configurations are loaded.
$source = drupal_get_path('module', 'configuration') . '/tests/test_configs/';
$configToImport = $this
->configToImport();
$results = ConfigurationManagement::importToActiveStore($configToImport, $this
->importDependencies(), $this
->importOptionals(), FALSE, $source);
$imported = $results
->getInfo('imported');
foreach ($configToImport as $config) {
$this
->assertTrue(in_array($config, $imported), "Configuration for {$config} was imported.");
}
if ($this
->importDependencies()) {
$dependencies = $this
->dependenciesToImport();
foreach ($dependencies as $config) {
$this
->assertTrue(in_array($config, $imported), "Dependency configuration {$config} was imported.");
}
}
if ($this
->importOptionals()) {
$optionals = $this
->optionalsToImport();
foreach ($optionals as $config) {
$this
->assertTrue(in_array($config, $imported), "Optional configuration {$config} was imported.");
}
}
$this
->assertTrue($this
->savedInActiveStore(), "The configuration was saved in the ActiveStore.");
$this
->extraChecksOnImport();
}