Commit 7d4fc2f7 authored by bircher's avatar bircher

Issue #3011363 by bircher: Ensure getAllCollectionNames returns unique collection names

parent 92166087
......@@ -224,7 +224,9 @@ class FilteredStorage implements FilteredStorageInterface {
foreach ($this->filters as $filter) {
$collections = $filter->filterGetAllCollectionNames($collections);
}
$collections = array_unique($collections);
sort($collections);
return $collections;
}
......
......@@ -114,6 +114,21 @@ class FilteredStorageTest extends CachedStorageTest {
$this->assertEquals($filteredCollection, $storageC->getCollectionName());
}
/**
* Test collection names from FilteredStorage::getAllCollectionNames().
*/
public function testGetAllCollectionNamesFilter() {
$source = $this->prophesize(StorageInterface::class);
$source->getAllCollectionNames()->willReturn(['a', 'b']);
$filter = $this->prophesizeFilter();
$filter->filterGetAllCollectionNames(['a', 'b'])->willReturn(['b', 'b', 'c']);
$storage = new FilteredStorage($source->reveal(), [$filter->reveal()]);
$this->assertEquals(['b', 'c'], $storage->getAllCollectionNames());
}
/**
* Test the read methods invokes the correct filter methods.
*
......
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