8000 added a functional test for locale handling in sub-requests · enumag/symfony@c4636e1 · GitHub
[go: up one dir, main page]

Skip to content

Commit c4636e1

Browse files
committed
added a functional test for locale handling in sub-requests
1 parent 05fdb12 commit c4636e1

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/FragmentController.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
class FragmentController extends ContainerAware
1919
{
20-
public function indexAction()
20+
public function indexAction(Request $request)
2121
{
2222
$actions = $this->container->get('templating')->get('actions');
2323

@@ -32,7 +32,10 @@ public function indexAction()
3232

3333
$html3 = $actions->render($actions->controller('TestBundle:Fragment:customlocale', array('_locale' => 'es')));
3434

35-
return new Response($html1.'--'.$html2.'--'.$html3);
35+
$request->setLocale('fr');
36+
$html4 = $actions->render($actions->controller('TestBundle:Fragment:forwardlocale'));
37+
38+
return new Response($html1.'--'.$html2.'--'.$html3.'--'.$html4);
3639
}
3740

3841
public function inlinedAction($options, $_format)
@@ -49,6 +52,11 @@ public function customLocaleAction(Request $request)
4952
{
5053
return new Response($request->getLocale());
5154
}
55+
56+
public function forwardLocaleAction(Request $request)
57+
{
58+
return new Response($request->getLocale());
59+
}
5260
}
5361

5462
class Bar

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/FragmentTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function testFragment($insulate)
2828

2929
$client->request('GET', '/fragment_home');
3030

31-
$this->assertEquals('bar txt--html--es', $client->getResponse()->getContent());
31+
$this->assertEquals('bar txt--html--es--fr', $client->getResponse()->getContent());
3232
}
3333

3434
public function getConfigs()

0 commit comments

Comments
 (0)
0