File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
src/lib/UI/Config/Provider/Module
tests/lib/UI/Config/Provider/Module Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -107,9 +107,9 @@ private function getImageConfig(): array
107107
108108 // The content type may not have the default fields; in that case, don't add the aggregations
109109 $ imageType = $ this ->contentTypeService ->loadContentType (self ::IMAGE_TYPE_ID );
110- foreach ($ this ->config ['image ' ]['aggregations ' ] as $ aggregation ) {
110+ foreach ($ this ->config ['image ' ]['aggregations ' ] as $ key => $ aggregation ) {
111111 if ($ imageType ->hasFieldDefinition ($ aggregation ['fieldDefinitionIdentifier ' ])) {
112- $ imageConfig ['aggregations ' ][] = $ aggregation ;
112+ $ imageConfig ['aggregations ' ][$ key ] = $ aggregation ;
113113 }
114114 }
115115
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,19 @@ private function mockContentTypeServiceLoadContentTypeByIdentifier(array $valueM
263264 ->willReturnMap ($ valueMap );
264265 }
265266
267+ /**
268+ * @param array<array<string|array<string>|ContentType>> $valueMap
269+ */
270+ private function mockContentTypeServiceLoadContentType (): void
271+ {
272+ $ contetnType = $ this ->createMock (ContentType::class);
273+ $ contetnType ->method ('hasFieldDefinition ' )->willReturn (true );
274+
275+ $ this ->contentTypeService
276+ ->method ('loadContentType ' )
277+ ->willReturn ($ contetnType );
278+ }
279+
266280 /**
267281 * @param array<array{string|array<string>}> $valueMap
268282 */
You can’t perform that action at this time.
0 commit comments