@@ -24,6 +24,36 @@ protected function createController()
2424 return new TestAbstractController ();
2525 }
2626
27+ /**
28+ * This test protects the default subscribed core services against accidental modification.
29+ *
30+ * @link https://github.com/symfony/symfony/pull/27415
31+ */
32+ public function testSubscribedServices ()
33+ {
34+ $ subscribed = AbstractController::getSubscribedServices ();
35+ $ expectedServices = array (
36+ 'router ' => '?Symfony \\Component \\Routing \\RouterInterface ' ,
37+ 'request_stack ' => '?Symfony \\Component \\HttpFoundation \\RequestStack ' ,
38+ 'http_kernel ' => '?Symfony \\Component \\HttpKernel \\HttpKernelInterface ' ,
39+ 'serializer ' => '?Symfony \\Component \\Serializer \\SerializerInterface ' ,
40+ 'session ' => '?Symfony \\Component \\HttpFoundation \\Session \\SessionInterface ' ,
41+ 'security.authorization_checker ' => '?Symfony \\Component \\Security \\Core \\Authorization \\AuthorizationCheckerInterface ' ,
42+ 'templating ' => '?Symfony \\Component \\Templating \\EngineInterface ' ,
43+ 'twig ' => '?Twig \\Environment ' ,
44+ 'doctrine ' => '?Doctrine \\Common \\Persistence \\ManagerRegistry ' ,
45+ 'form.factory ' => '?Symfony \\Component \\Form \\FormFactoryInterface ' ,
46+ 'security.token_storage ' => '?Symfony \\Component \\Security \\Core \\Authentication \\Token \\Storage \\TokenStorageInterface ' ,
47+ 'security.csrf.token_manager ' => '?Symfony \\Component \\Security \\Csrf \\CsrfTokenManagerInterface ' ,
48+ 'parameter_bag ' => '?Symfony \\Component \\DependencyInjection \\ParameterBag \\ContainerBagInterface ' ,
49+ 'message_bus ' => '?Symfony \\Component \\Messenger \\MessageBusInterface ' ,
50+ );
51+
52+ foreach ($ expectedServices as $ id => $ reference ) {
53+ $ this ->assertSame ($ reference , $ subscribed [$ id ]);
54+ }
55+ }
56+
2757 public function testGetParameter ()
2858 {
2959 $ container = new Container (new FrozenParameterBag (array ('foo ' => 'bar ' )));
0 commit comments