File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
src/lib/UI/Config/Provider/Module
tests/lib/UI/Config/Provider/Module Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -102,14 +102,15 @@ private function getImageConfig(): array
102102 {
103103 $imageConfig = [
104104 'showImageFilters' => $this->showImageFilters(),
105+ 'aggregations' => [],
105106 'enableMultipleDownload' => extension_loaded('zip'),
106107 ];
107108
108109 // The content type may not have the default fields; in that case, don't add the aggregations
109110 $imageType = $this->contentTypeService->loadContentType(self::IMAGE_TYPE_ID);
110- foreach ($this->config['image']['aggregations'] as $aggregation) {
111+ foreach ($this->config['image']['aggregations'] as $key => $ aggregation) {
111112 if ($imageType->hasFieldDefinition($aggregation['fieldDefinitionIdentifier'])) {
112- $imageConfig['aggregations'][] = $aggregation;
113+ $imageConfig['aggregations'][$key ] = $aggregation;
113114 }
114115 }
115116
Original file line number Diff line number Diff line change @@ -137,6 +137,7 @@ public function testGetConfig(
137137 $this->mockRepositoryConfigurationProviderGetRepositoryConfig($repositoryConfig);
138138 $this->mockContentTypeServiceLoadContentTypeByIdentifier($loadContentTypeValueMap);
139139 $this->mockSchemaIdentifierExtractorExtract($extractSchemaIdentifiersValueMap);
140+ $this->mockContentTypeServiceLoadContentType();
140141
141142 self::assertEquals(
142143 $expectedConfiguration,
@@ -263,6 +264,16 @@ private function mockContentTypeServiceLoadContentTypeByIdentifier(array $valueM
263264 ->willReturnMap($valueMap);
264265 }
265266
267+ private function mockContentTypeServiceLoadContentType(): void
268+ {
269+ $contetnType = $this->createMock(ContentType::class);
270+ $contetnType->method('hasFieldDefinition')->willReturn(true);
271+
272+ $this->contentTypeService
273+ ->method('loadContentType')
274+ ->willReturn($contetnType);
275+ }
276+
266277 /**
267278 * @param array<array{string|array<string>}> $valueMap
268279 */
You can’t perform that action at this time.
0 commit comments