diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigImportTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigImportTest.php index c768c98..d4328ce 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigImportTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigImportTest.php @@ -19,7 +19,7 @@ class ConfigImportTest extends DrupalUnitTestBase { * * @var array */ - public static $modules = array('system', 'config_test'); + public static $modules = array('config_test', 'system'); public static function getInfo() { return array( @@ -62,11 +62,6 @@ function testDeleted() { $dynamic_name = 'config_test.dynamic.default'; $storage = $this->container->get('config.storage'); $staging = $this->container->get('config.storage.staging'); - $snapshot = $this->container->get('config.storage.snapshot'); - - // Create a snapshot and verify that it matches the active configuration. - config_import_create_snapshot($storage, $snapshot); - $this->assertFalse(config_sync_get_changes($snapshot, $storage)); // Verify the default configuration values exist. $config = config($dynamic_name); @@ -93,10 +88,6 @@ function testDeleted() { // Verify that there is nothing more to import. $this->assertFalse(config_sync_get_changes($staging, $storage)); - - // Verify that a new snapshot was successfully created, and that its values - // match the active configuration. - $this->assertFalse(config_sync_get_changes($snapshot, $storage)); } /** @@ -106,11 +97,6 @@ function testNew() { $dynamic_name = 'config_test.dynamic.new'; $storage = $this->container->get('config.storage'); $staging = $this->container->get('config.storage.staging'); - $snapshot = $this->container->get('config.storage.snapshot'); - - // Create a snapshot and verify that it matches the active configuration. - config_import_create_snapshot($storage, $snapshot); - $this->assertFalse(config_sync_get_changes($snapshot, $storage)); // Verify the configuration to create does not exist yet. $this->assertIdentical($storage->exists($dynamic_name), FALSE, $dynamic_name . ' not found.'); @@ -151,10 +137,6 @@ function testNew() { // Verify that there is nothing more to import. $this->assertFalse(config_sync_get_changes($staging, $storage)); - - // Verify that a new snapshot was successfully created, and that its values - // match the active configuration. - $this->assertFalse(config_sync_get_changes($snapshot, $storage)); } /** @@ -165,11 +147,6 @@ function testUpdated() { $dynamic_name = 'config_test.dynamic.default'; $storage = $this->container->get('config.storage'); $staging = $this->container->get('config.storage.staging'); - $snapshot = $this->container->get('config.storage.snapshot'); - - // Create a snapshot and verify that it matches the active configuration. - config_import_create_snapshot($storage, $snapshot); - $this->assertFalse(config_sync_get_changes($snapshot, $storage)); // Verify that the configuration objects to import exist. $this->assertIdentical($storage->exists($name), TRUE, $name . ' found.'); @@ -217,10 +194,6 @@ function testUpdated() { // Verify that there is nothing more to import. $this->assertFalse(config_sync_get_changes($staging, $storage)); - - // Verify that a new snapshot was successfully created, and that its values - // match the active configuration. - $this->assertFalse(config_sync_get_changes($snapshot, $storage)); } } diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigSnapshotTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigSnapshotTest.php index 84781f5..89ca680 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigSnapshotTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigSnapshotTest.php @@ -26,52 +26,54 @@ public static function getInfo() { * Tests config snapshot creation and updating. */ function testSnapshot() { - $storage = $this->container->get('config.storage'); + $active = $this->container->get('config.storage'); $staging = $this->container->get('config.storage.staging'); $snapshot = $this->container->get('config.storage.snapshot'); - $name = 'system.performance'; - $key = 'cache.page.max_age'; + + $config_name = 'system.performance'; + $config_key = 'cache.page.max_age'; $original_data = '0'; $new_data = '10'; - // Verify that we have an initial snapshot of configuration that matches - // the active configuration. - $this->assertFalse(config_sync_get_changes($snapshot, $storage)); + // Verify that we have an initial snapshot that matches the active + // configuration. + $this->assertFalse(config_sync_get_changes($snapshot, $active)); - // Write new data to the active directory. - $config = config($name); - $config->set($key, $new_data)->save(); + // Change a configuration value. + $config = config($config_name); + $config->set($config_key, $new_data)->save(); $staging_data = $config->get(); // Verify the active configuration contains the saved value. - $this->assertIdentical(config($name)->get($key), $new_data); + $this->assertIdentical(config($config_name)->get($config_key), $new_data); // Verify that the active and snapshot storage do not match. - $this->assertTrue(config_sync_get_changes($snapshot, $storage)); + $this->assertTrue(config_sync_get_changes($snapshot, $active)); // Reset data back to original value. - config_restore_from_snapshot($name, 'change'); + config_restore_from_snapshot($config_name, 'change'); // Verify that the active and snapshot storage match again. - $this->assertFalse(config_sync_get_changes($snapshot, $storage)); + $this->assertFalse(config_sync_get_changes($snapshot, $active)); - // Write modified data to staging. - $staging->write($name, $staging_data); + // Change a configuration value in staging. + $staging->write($config_name, $staging_data); // Verify that active and snapshot match, and that staging doesn't match - // either. - $this->assertFalse(config_sync_get_changes($snapshot, $storage)); + // either of them. + $this->assertFalse(config_sync_get_changes($snapshot, $active)); $this->assertTrue(config_sync_get_changes($snapshot, $staging)); - $this->assertTrue(config_sync_get_changes($staging, $storage)); + $this->assertTrue(config_sync_get_changes($staging, $active)); - // Import. + // Import changed data from staging to active. config_import(); - // Verify config was imported. - $this->assertIdentical(config($name)->get($key), $new_data); + // Verify changed config was properly imported. + $this->assertIdentical(config($config_name)->get($config_key), $new_data); - // Verify that active and snapshot match after new config imported. - $this->assertFalse(config_sync_get_changes($snapshot, $storage)); + // Verify that a new snapshot was created which and that it matches + // the active config. + $this->assertFalse(config_sync_get_changes($snapshot, $active)); } }