8000 minor #31713 [FrameworkBundle] fix test fixture using deprecated cont… · symfony/symfony@d0cef82 · GitHub
[go: up one dir, main page]

Skip to content

Commit d0cef82

Browse files
committed
minor #31713 [FrameworkBundle] fix test fixture using deprecated controller (Tobion)
This PR was merged into the 4.3 branch. Discussion ---------- [FrameworkBundle] fix test fixture using deprecated controller | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | | License | MIT | Doc PR | https://github.com/symfony/symfony/pull/21035/files#diff-636946f5b52668178ede98d59135a181 reintroduced some deprecated controller notations (#26085) which wasn't spotted because ResolveControllerNameSubscriber missed a deprecation trigger. This also adds this trigger. Commits ------- 7f00a74 [FrameworkBundle] fix test fixture using deprecated controller and add missing deprecation
2 parents e1923c6 + 7f00a74 commit d0cef82

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

src/Symfony/Bundle/FrameworkBundle/EventListener/ResolveControllerNameSubscriber.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ public function onKernelRequest(GetResponseEvent $event)
3737
$controller = $event->getRequest()->attributes->get('_controller');
3838
if (\is_string($controller) && false === strpos($controller, '::') && 2 === substr_count($controller, ':')) {
3939
// controller in the a:b:c notation then
40-
$event->getRequest()->attributes->set('_controller', $this->parser->parse($controller, false));
40+
$event->getRequest()->attributes->set('_controller', $parsedNotation = $this->parser->parse($controller, false));
41+
42+
@trigger_error(sprintf('Referencing controllers with %s is deprecated since Symfony 4.1, use "%s" instead.', $controller, $parsedNotation), E_USER_DEPRECATED);
4143
}
4244
}
4345

src/Symfony/Bundle/FrameworkBundle/Tests/EventListener/ResolveControllerNameSubscriberTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020

2121
class ResolveControllerNameSubscriberTest extends TestCase
2222
{
23+
/**
24+
* @group legacy
25+
*/
2326
public function testReplacesControllerAttribute()
2427
{
2528
$parser = $this->getMockBuilder(ControllerNameParser::class)->disableOriginalConstructor()->getMock();
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
{{ render(controller('TestBundle:Fragment:inlined', {'options': {'bar': bar, 'eleven': 11}})) }}
1+
{{ render(controller('Symfony\\Bundle\\FrameworkBundle\\Tests\\Functional\\Bundle\\TestBundle\\Controller\\FragmentController::inlinedAction', {'options': {'bar': bar, 'eleven': 11}})) }}
22
--
3-
{{ render(controller('TestBundle:Fragment:customformat', {'_format': 'html'})) }}
3+
{{ render(controller('Symfony\\Bundle\\FrameworkBundle\\Tests\\Functional\\Bundle\\TestBundle\\Controller\\FragmentController::customformatAction', {'_format': 'html'})) }}
44
--
5-
{{ render(controller('TestBundle:Fragment:customlocale', {'_locale': 'es'})) }}
5+
{{ render(controller('Symfony\\Bundle\\FrameworkBundle\\Tests\\Functional\\Bundle\\TestBundle\\Controller\\FragmentController::customlocaleAction', {'_locale': 'es'})) }}
66
--
7-
{{ app.request.setLocale('fr') }}{{ render(controller('TestBundle:Fragment:forwardlocale')) -}}
7+
{{ app.request.setLocale('fr') }}{{ render(controller('Symfony\\Bundle\\FrameworkBundle\\Tests\\Functional\\Bundle\\TestBundle\\Controller\\FragmentController::forwardlocaleAction')) -}}

0 commit comments

Comments
 (0)
0