diff --git a/core/modules/config/config.test b/core/modules/config/config.test index c59ec764d64..afb0bafba94 100644 --- a/core/modules/config/config.test +++ b/core/modules/config/config.test @@ -206,6 +206,39 @@ class ConfigFileContentTestCase extends DrupalWebTestCase { // Read unset nested value $this->assertNull($config->get($nested_key), t('Nested value unset.')); + // Create two new configuration files to test listing + $config = config('foo.baz'); + $config->set($key, $value); + $config->save(); + + $config = config('biff.bang'); + $config->set($key, $value); + $config->save(); + + // Get file listing for all files starting with 'foo'. Should return + // two elements. + $files = config_get_signed_file_storage_names_with_prefix('foo'); + debug($files); + $this->assertEqual(count($files), 2, 'Two files listed with the prefix \'foo\'.'); + + // Get file listing for all files starting with 'biff'. Should return + // one element. + $files = config_get_signed_file_storage_names_with_prefix('biff'); + debug($files); + $this->assertEqual(count($files), 1, 'One file listed with the prefix \'biff\'.'); + + // Get file listing for all files starting with 'foo.bar'. Should return + // one element. + $files = config_get_signed_file_storage_names_with_prefix('foo.bar'); + debug($files); + $this->assertEqual(count($files), 1, 'One file listed with the prefix \'foo.bar\'.'); + + // Get file listing for all files starting with 'bar'. Should return + // an empty array. + $files = config_get_signed_file_storage_names_with_prefix('bar'); + debug($files); + $this->assertEqual($files, array(), 'No files listed with the prefix \'bar\'.'); + // Delete the configuration. $config = config($name); $config->delete(); @@ -214,7 +247,7 @@ class ConfigFileContentTestCase extends DrupalWebTestCase { $db_config = db_query('SELECT * FROM {config} WHERE name = :name', array(':name' => $name))->fetch(); $this->assertIdentical($db_config, FALSE); $this->assertFalse(file_exists($config_dir . '/' . $name . '.' . $this->fileExtension)); - + // Chainable ->set()->save() // Attempt to delete non-existing configuration. // Type casting into string. (recursively)