$response->
setStaleWhileRevalidate(300
);
$cacheControl =
$response->headers->
get('Cache-Control'
);
$this->
assertEquals('stale-while-revalidate=300, private',
$cacheControl);
} public function testIsPrivate() { $response =
new Response();
$response->headers->
set('Cache-Control', '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'
);
$response =
new Response();
$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() {