[FrameworkBundle] fix test fixture using deprecated controller and add missing deprecation
This commit is contained in:
parent
e1923c620d
commit
7f00a74754
@ -37,7 +37,9 @@ class ResolveControllerNameSubscriber implements EventSubscriberInterface
|
||||
$controller = $event->getRequest()->attributes->get('_controller');
|
||||
if (\is_string($controller) && false === strpos($controller, '::') && 2 === substr_count($controller, ':')) {
|
||||
// controller in the a:b:c notation then
|
||||
$event->getRequest()->attributes->set('_controller', $this->parser->parse($controller, false));
|
||||
$event->getRequest()->attributes->set('_controller', $parsedNotation = $this->parser->parse($controller, false));
|
||||
|
||||
@trigger_error(sprintf('Referencing controllers with %s is deprecated since Symfony 4.1, use "%s" instead.', $controller, $parsedNotation), E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,9 @@ use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
|
||||
class ResolveControllerNameSubscriberTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testReplacesControllerAttribute()
|
||||
{
|
||||
$parser = $this->getMockBuilder(ControllerNameParser::class)->disableOriginalConstructor()->getMock();
|
||||
|
@ -1,7 +1,7 @@
|
||||
{{ render(controller('TestBundle:Fragment:inlined', {'options': {'bar': bar, 'eleven': 11}})) }}
|
||||
{{ render(controller('Symfony\\Bundle\\FrameworkBundle\\Tests\\Functional\\Bundle\\TestBundle\\Controller\\FragmentController::inlinedAction', {'options': {'bar': bar, 'eleven': 11}})) }}
|
||||
--
|
||||
{{ render(controller('TestBundle:Fragment:customformat', {'_format': 'html'})) }}
|
||||
{{ render(controller('Symfony\\Bundle\\FrameworkBundle\\Tests\\Functional\\Bundle\\TestBundle\\Controller\\FragmentController::customformatAction', {'_format': 'html'})) }}
|
||||
--
|
||||
{{ render(controller('TestBundle:Fragment:customlocale', {'_locale': 'es'})) }}
|
||||
{{ render(controller('Symfony\\Bundle\\FrameworkBundle\\Tests\\Functional\\Bundle\\TestBundle\\Controller\\FragmentController::customlocaleAction', {'_locale': 'es'})) }}
|
||||
--
|
||||
{{ app.request.setLocale('fr') }}{{ render(controller('TestBundle:Fragment:forwardlocale')) -}}
|
||||
{{ app.request.setLocale('fr') }}{{ render(controller('Symfony\\Bundle\\FrameworkBundle\\Tests\\Functional\\Bundle\\TestBundle\\Controller\\FragmentController::forwardlocaleAction')) -}}
|
||||
|
Reference in New Issue
Block a user