added a functional test for locale handling in sub-requests
This commit is contained in:
parent
05fdb12ad9
commit
c4636e1252
|
@ -17,7 +17,7 @@ use Symfony\Component\DependencyInjection\ContainerAware;
|
|||
|
||||
class FragmentController extends ContainerAware
|
||||
{
|
||||
public function indexAction()
|
||||
public function indexAction(Request $request)
|
||||
{
|
||||
$actions = $this->container->get('templating')->get('actions');
|
||||
|
||||
|
@ -32,7 +32,10 @@ class FragmentController extends ContainerAware
|
|||
|
||||
$html3 = $actions->render($actions->controller('TestBundle:Fragment:customlocale', array('_locale' => 'es')));
|
||||
|
||||
return new Response($html1.'--'.$html2.'--'.$html3);
|
||||
$request->setLocale('fr');
|
||||
$html4 = $actions->render($actions->controller('TestBundle:Fragment:forwardlocale'));
|
||||
|
||||
return new Response($html1.'--'.$html2.'--'.$html3.'--'.$html4);
|
||||
}
|
||||
|
||||
public function inlinedAction($options, $_format)
|
||||
|
@ -49,6 +52,11 @@ class FragmentController extends ContainerAware
|
|||
{
|
||||
return new Response($request->getLocale());
|
||||
}
|
||||
|
||||
public function forwardLocaleAction(Request $request)
|
||||
{
|
||||
return new Response($request->getLocale());
|
||||
}
|
||||
}
|
||||
|
||||
class Bar
|
||||
|
|
|
@ -28,7 +28,7 @@ class FragmentTest extends WebTestCase
|
|||
|
||||
$client->request('GET', '/fragment_home');
|
||||
|
||||
$this->assertEquals('bar txt--html--es', $client->getResponse()->getContent());
|
||||
$this->assertEquals('bar txt--html--es--fr', $client->getResponse()->getContent());
|
||||
}
|
||||
|
||||
public function getConfigs()
|
||||
|
|
Reference in New Issue