@@ -208,6 +208,10 @@ public function testCommonConfiguration(): void
208208 'api_platform.state_processor.respond ' ,
209209 'api_platform.state_processor.add_link_header ' ,
210210 'api_platform.state_processor.serialize ' ,
211+
212+ 'api_platform.swagger_ui.context ' ,
213+ 'api_platform.swagger_ui.processor ' ,
214+ 'api_platform.swagger_ui.provider ' ,
211215 ];
212216
213217 $ aliases = [
@@ -256,6 +260,43 @@ public function testCommonConfiguration(): void
256260 }
257261 }
258262
263+ public function testSwaggerUiDisabledConfiguration (): void
264+ {
265+ $ config = self ::DEFAULT_CONFIG ;
266+ $ config ['api_platform ' ]['enable_swagger ' ] = true ;
267+ $ config ['api_platform ' ]['enable_swagger_ui ' ] = false ;
268+ $ config ['api_platform ' ]['use_symfony_listeners ' ] = true ;
269+
270+ (new ApiPlatformExtension ())->load ($ config , $ this ->container );
271+
272+ $ this ->assertNotContainerHasService ('api_platform.swagger_ui.processor ' );
273+
274+ $ this ->assertNotContainerHasService ('api_platform.swagger_ui.context ' );
275+
276+ $ this ->assertNotContainerHasService ('api_platform.swagger_ui.provider ' );
277+
278+ $ this ->assertNotContainerHasService ('api_platform.swagger_ui.documentation.provider ' );
279+ }
280+
281+ public function testSwaggerUiEnabledConfiguration (): void
282+ {
283+ $ config = self ::DEFAULT_CONFIG ;
284+ $ config ['api_platform ' ]['enable_swagger ' ] = true ;
285+ $ config ['api_platform ' ]['enable_swagger_ui ' ] = true ;
286+ $ config ['api_platform ' ]['use_symfony_listeners ' ] = true ;
287+
288+ (new ApiPlatformExtension ())->load ($ config , $ this ->container );
289+
290+ $ services = [
291+ 'api_platform.swagger_ui.processor ' ,
292+ 'api_platform.swagger_ui.context ' ,
293+ 'api_platform.swagger_ui.provider ' ,
294+ 'api_platform.swagger_ui.documentation.provider ' ,
295+ ];
296+
297+ $ this ->assertContainerHas ($ services );
298+ }
299+
259300 public function testEventListenersConfiguration (): void
260301 {
261302 $ config = self ::DEFAULT_CONFIG ;
0 commit comments