public function HttpCacheTest::testDoesNotReloadResponsesWhenAllowReloadIsSetFalseDefault in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTest.php \Symfony\Component\HttpKernel\Tests\HttpCache\HttpCacheTest::testDoesNotReloadResponsesWhenAllowReloadIsSetFalseDefault()
File
- vendor/
symfony/ http-kernel/ Tests/ HttpCache/ HttpCacheTest.php, line 268
Class
Namespace
Symfony\Component\HttpKernel\Tests\HttpCacheCode
public function testDoesNotReloadResponsesWhenAllowReloadIsSetFalseDefault() {
$count = 0;
$this
->setNextResponse(200, array(
'Cache-Control' => 'public, max-age=10000',
), '', function ($request, $response) use (&$count) {
++$count;
$response
->setContent(1 == $count ? 'Hello World' : 'Goodbye World');
});
$this
->request('GET', '/');
$this
->assertEquals(200, $this->response
->getStatusCode());
$this
->assertEquals('Hello World', $this->response
->getContent());
$this
->assertTraceContains('store');
$this
->request('GET', '/');
$this
->assertEquals(200, $this->response
->getStatusCode());
$this
->assertEquals('Hello World', $this->response
->getContent());
$this
->assertTraceContains('fresh');
$this->cacheConfig['allow_reload'] = false;
$this
->request('GET', '/', array(
'HTTP_CACHE_CONTROL' => 'no-cache',
));
$this
->assertEquals(200, $this->response
->getStatusCode());
$this
->assertEquals('Hello World', $this->response
->getContent());
$this
->assertTraceNotContains('reload');
$this
->request('GET', '/', array(
'HTTP_CACHE_CONTROL' => 'no-cache',
));
$this
->assertEquals(200, $this->response
->getStatusCode());
$this
->assertEquals('Hello World', $this->response
->getContent());
$this
->assertTraceNotContains('reload');
}