File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
src/lib/UI/Config/Provider/Module
tests/lib/UI/Config/Provider/Module Expand file tree Collapse file tree 2 files changed +17
-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,20 @@ private function mockContentTypeServiceLoadContentTypeByIdentifier(array $valueM
263264 ->willReturnMap ($ valueMap );
264265 }
265266
267+
268+ /**
269+ * @param array<array<string|array<string>|ContentType>> $valueMap
270+ */
271+ private function mockContentTypeServiceLoadContentType (): void
272+ {
273+ $ contetnType = $ this ->createMock (ContentType::class);
274+ $ contetnType ->method ('hasFieldDefinition ' )->willReturn (true );
275+
276+ $ this ->contentTypeService
277+ ->method ('loadContentType ' )
278+ ->willReturn ($ contetnType );
279+ }
280+
266281 /**
267282 * @param array<array{string|array<string>}> $valueMap
268283 */
You can’t perform that action at this time.
0 commit comments