Commit 7b9d7ab0 authored by webchick's avatar webchick

Issue #2170117 by webflo: CMI FileStorage fails with absolute paths.

parent 9bbf4b9e
......@@ -208,7 +208,7 @@ public function listAll($prefix = '') {
throw new StorageException($this->directory . '/ not found.');
}
$extension = '.' . static::getFileExtension();
$files = new \GlobIterator(DRUPAL_ROOT . '/' . $this->directory . '/' . $prefix . '*' . $extension);
$files = new \GlobIterator($this->directory . '/' . $prefix . '*' . $extension);
$names = array();
foreach ($files as $file) {
......
......@@ -47,4 +47,24 @@ protected function update($name, $data) {
protected function delete($name) {
unlink($this->storage->getFilePath($name));
}
/**
* Tests the FileStorage::listAll method with a relative and absolute path.
*/
protected function testlistAll() {
$expected_files = array(
'system.module',
'system.performance',
);
$config_files = $this->storage->listAll();
$this->assertIdentical($config_files, $expected_files, 'Relative path, two config files found.');
// Initialize FileStorage with absolute file path.
$absolute_path = realpath($this->configDirectories[CONFIG_ACTIVE_DIRECTORY]);
$storage_absolute_path = new FileStorage($absolute_path);
$config_files = $storage_absolute_path->listAll();
$this->assertIdentical($config_files, $expected_files, 'Absolute path, two config files found.');
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment