@@ -646,10 +646,26 @@ public function testValidatorAliasWhenDisabled()
646646
647647 /**
648648 * @group legacy
649+ * @expectedDeprecation Enabling the route generation feature is deprecated since FOSRestBundle 2.8.
649650 */
650651 public function testConfigLoadWithRoutingLoaderEnabled ()
651652 {
652- $ this ->extension ->load ([], $ this ->container );
653+ $ config = [
654+ 'fos_rest ' => [
655+ 'exception ' => [
656+ 'exception_listener ' => false ,
657+ 'serialize_exceptions ' => false ,
658+ ],
659+ 'service ' => [
660+ 'templating ' => null ,
661+ ],
662+ 'view ' => [
663+ 'default_engine ' => null ,
664+ 'force_redirects ' => [],
665+ ],
666+ ],
667+ ];
668+ $ this ->extension ->load ($ config , $ this ->container );
653669
654670 $ this ->assertTrue ($ this ->container ->hasDefinition ('fos_rest.routing.loader.controller ' ));
655671
@@ -681,6 +697,56 @@ public function testConfigLoadWithRoutingLoaderEnabled()
681697 );
682698 }
683699
700+ public function testRoutingLoaderDisabled ()
701+ {
702+ $ config = [
703+ 'fos_rest ' => [
704+ 'exception ' => [
705+ 'exception_listener ' => false ,
706+ 'serialize_exceptions ' => false ,
707+ ],
708+ 'routing_loader ' => false ,
709+ 'service ' => [
710+ 'templating ' => null ,
711+ ],
712+ 'view ' => [
713+ 'default_engine ' => null ,
714+ 'force_redirects ' => [],
715+ ],
716+ ],
717+ ];
718+ $ this ->extension ->load ($ config , $ this ->container );
719+
720+ $ this ->assertFalse ($ this ->container ->hasDefinition ('fos_rest.routing.loader.yaml_collection ' ));
721+ $ this ->assertFalse ($ this ->container ->hasDefinition ('fos_rest.routing.loader.xml_collection ' ));
722+ }
723+
724+ public function testRoutingLoaderDisabledUsingEnabledKey ()
725+ {
726+ $ config = [
727+ 'fos_rest ' => [
728+ 'exception ' => [
729+ 'exception_listener ' => false ,
730+ 'serialize_exceptions ' => false ,
731+ ],
732+ 'routing_loader ' => [
733+ 'enabled ' => false ,
734+ ],
735+ 'service ' => [
736+ 'templating ' => null ,
737+ ],
738+ 'view ' => [
739+ 'default_engine ' => null ,
740+ 'force_redirects ' => [],
741+ ],
742+ ],
743+ ];
744+ $ this ->extension ->load ($ config , $ this ->container );
745+
746+ $ this ->assertFalse ($ this ->container ->hasDefinition ('fos_rest.routing.loader.yaml_collection ' ));
747+ $ this ->assertFalse ($ this ->container ->hasDefinition ('fos_rest.routing.loader.xml_collection ' ));
748+ }
749+
684750 /**
685751 * @group legacy
686752 */
@@ -995,6 +1061,7 @@ public function testResponseStatusCodeListenerEnabled()
9951061 'serialize_exceptions ' => false ,
9961062 'map_exception_codes ' => true ,
9971063 ],
1064+ 'routing_loader ' => false ,
9981065 'service ' => [
9991066 'templating ' => null ,
10001067 ],
@@ -1017,6 +1084,7 @@ public function testExceptionListenerDisabled()
10171084 'exception_listener ' => false ,
10181085 'serialize_exceptions ' => false ,
10191086 ],
1087+ 'routing_loader ' => false ,
10201088 'service ' => [
10211089 'templating ' => null ,
10221090 ],
@@ -1043,6 +1111,7 @@ public function testExceptionSerializerEnabled()
10431111 'exception_listener ' => false ,
10441112 'serialize_exceptions ' => true ,
10451113 ],
1114+ 'routing_loader ' => false ,
10461115 'service ' => [
10471116 'templating ' => null ,
10481117 ],
@@ -1066,6 +1135,7 @@ public function testExceptionSerializerDisabled()
10661135 'exception_listener ' => false ,
10671136 'serialize_exceptions ' => false ,
10681137 ],
1138+ 'routing_loader ' => false ,
10691139 'service ' => [
10701140 'templating ' => null ,
10711141 ],
0 commit comments