8000 Test subscriptions in AbstractController for accidental modification · symfony/symfony@15fae6f · GitHub
[go: up one dir, main page]

Skip to content

Commit 15fae6f

Browse files
committed
Test subscriptions in AbstractController for accidental modification
1 parent 94c6411 commit 15fae6f

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/Symfony/Bundle/FrameworkBundle/Tests/Controller/AbstractControllerTest.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)
0