8000 failing test to reproduce session problem · symfony/symfony@7569f23 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7569f23

Browse files
dmaichernicolas-grekas
authored andcommitted
failing test to reproduce session problem
1 parent d8c336b commit 7569f23

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ public function welcomeAction(Request $request, $name = null)
4343
return new Response(sprintf('Welcome back %s, nice to meet you.', $name));
4444
}
4545

46+
public function cacheableAction()
47+
{
48+
$response = new Response('all good');
49+
$response->setSharedMaxAge(100);
50+
51+
return $response;
52+
}
53+
4654
public function logoutAction(Request $request)
4755
{
4856
$request->getSession()->invalidate();

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Resources/config/routing.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ session_welcome:
22
path: /session
33
defaults: { _controller: TestBundle:Session:welcome }
44

5+
session_cacheable:
6+
path: /cacheable
7+
defaults: { _controller: Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\Controller\SessionController::cacheableAction }
8+
59
session_welcome_name:
610
path: /session/{name}
711
defaults: { _controller: TestBundle:Session:welcome }

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,22 @@ public function testTwoClients($config, $insulate)
126126
$this->assertContains('Welcome back client2, nice to meet you.', $crawler2->text());
127127
}
128128

129+
/**
130+
* @dataProvider getConfigs
131+
*/
132+
public function testCorrectCacheControlHeadersForCacheableAction($config, $insulate)
133+
{
134+
$client = $this->createClient(array('test_case' => 'Session', 'root_config' => $config));
135+
if ($insulate) {
136+
$client->insulate();
137+
}
138+
139+
$client->request('GET', '/cacheable');
140+
141+
$response = $client->getResponse();
142+
$this->assertSame('public, s-maxage=100', $response->headers->get('cache-control'));
143+
}
144+
129145
public function getConfigs()
130146
{
131147
return array(

0 commit comments

Comments
 (0)
0