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