$response->headers->
set('Cache-Control', 'public, max-age=100'
);
$response->
setPrivate();
$this->
assertEquals(100,
$response->headers->
getCacheControlDirective('max-age'
), '->isPrivate() adds the private Cache-Control directive when set to true'
);
$this->
assertTrue($response->headers->
getCacheControlDirective('private'
), '->isPrivate() adds the private Cache-Control directive when set to true'
);
$this->
assertFalse($response->headers->
hasCacheControlDirective('public'
), '->isPrivate() removes the public Cache-Control directive'
);
} public function testExpire() { $response =
new Response();
$response->headers->
set('Cache-Control', 'max-age=100'
);
$response->
expire();
$this->
assertEquals(100,
$response->headers->
get('Age'
), '->expire() sets the Age to max-age when present'
);
$response =
new Response();
$response->headers->
set('Cache-Control', 'max-age=100, s-maxage=500'
);
$response->
expire();
$this->
assertEquals(500,
$response->headers->
get('Age'
), '->expire() sets the Age to s-maxage when both max-age and s-maxage are present'
);
$response =
new Response();
$response->headers->
set('Cache-Control', 'max-age=5, s-maxage=500'
);
$response->headers->
set('Age', '1000'
);
$response->
expire();