Skip to content
Snippets Groups Projects
Commit 7b9d7ab0 authored by Angie Byron's avatar Angie Byron
Browse files

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

parent 9bbf4b9e
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -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.');
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment