8000 Insert correct parameter_bag service in AbstractController · symfony/symfony@37270d7 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 37270d7

Browse files
curry684nicolas-grekas
authored andcommitted
Insert correct parameter_bag service in AbstractController
1 parent e0ec1f3 commit 37270d7

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Psr\Container\ContainerInterface;
1515
use Doctrine\Common\Persistence\ManagerRegistry;
16+
use Symfony\Component\DependencyInjection\ParameterBag\ContainerBagInterface;
1617
use Symfony\Component\DependencyInjection\ServiceSubscriberInterface;
1718
use Symfony\Component\Form\FormFactoryInterface;
1819
use Symfony\Component\HttpFoundation\RequestStack;
@@ -84,7 +85,7 @@ public static function getSubscribedServices()
8485
'form.factory' => '?'.FormFactoryInterface::class,
8586
'security.token_storage' => '?'.TokenStorageInterface::class,
8687
'security.csrf.token_manager' => '?'.CsrfTokenManagerInterface::class,
87-
'parameter_bag' => '?'.ContainerInterface::class,
88+
'parameter_bag' => '?'.ContainerBagInterface::class,
8889
'message_bus' => '?'.MessageBusInterface::class,
8990
);
9091
}

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

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

Comments
 (0)
0