$response =
new Response('', 200
);
$now =
$this->
createDateTimeNow();
$response->headers->
remove('Date'
);
$date =
$response->
getDate();
$this->
assertEquals($now->
getTimestamp(),
$date->
getTimestamp(), '->getDate() returns the current Date when the header has previously been removed'
);
} public function testGetMaxAge() { $response =
new Response();
$response->headers->
set('Cache-Control', 's-maxage=600, max-age=0'
);
$this->
assertEquals(600,
$response->
getMaxAge(), '->getMaxAge() uses s-maxage cache control directive when present'
);
$response =
new Response();
$response->headers->
set('Cache-Control', 'max-age=600'
);
$this->
assertEquals(600,
$response->
getMaxAge(), '->getMaxAge() falls back to max-age when no s-maxage directive present'
);
$response =
new Response();
$response->headers->
set('Cache-Control', 'must-revalidate'
);
$response->headers->
set('Expires',
$this->
createDateTimeOneHourLater()->
format(\DATE_RFC2822
));
$this->
assertEquals(3600,
$response->
getMaxAge(), '->getMaxAge() falls back to Expires when no max-age or s-maxage directive present'
);
$response =
new Response();