You are here

public function ConfigurationApiTest::testimportToActiveStore in Configuration Management 7.2

File

tests/configuration.test, line 150
Tests for Configuration Management

Class

ConfigurationApiTest

Code

public function testimportToActiveStore() {
  $results = ConfigurationManagement::startTracking(array(
    'content_type.article',
  ));
  $exported = $results
    ->getInfo('exported');
  $handler = ConfigurationManagement::getConfigurationHandler('content_type');
  $content_types = node_type_get_types();
  $article = $content_types['article'];
  $article->description = 'modified';
  node_type_save($article);
  $modified_config = ConfigurationManagement::createConfigurationInstance('content_type.article');
  $original_config = ConfigurationManagement::createConfigurationInstance('content_type.article');
  $original_config
    ->loadFromStorage();
  $modified_config
    ->loadFromActiveStore();
  $this
    ->assertTrue($original_config
    ->getHash() != $modified_config
    ->getHash(), "Hash for content type Article has changed after modify the content type.");
  $results = ConfigurationManagement::importToActiveStore(array(
    'content_type.article',
  ));
  $modified_config
    ->loadFromActiveStore();
  $this
    ->assertTrue($original_config
    ->getHash() == $modified_config
    ->getHash(), "Configuration for content type Article has been reverted.");
}