Added tests for file listing
parent
86b6fe2f20
commit
d0579d92f5
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue