mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Implementing CakeResponse::disableCache()
This commit is contained in:
parent
20d1e483cc
commit
5ba0e43aa3
2 changed files with 22 additions and 1 deletions
|
@ -493,7 +493,12 @@ class CakeResponse {
|
|||
* @return void
|
||||
*/
|
||||
public function disableCache() {
|
||||
|
||||
$this->header(array(
|
||||
'Expires' => 'Mon, 26 Jul 1997 05:00:00 GMT',
|
||||
'Last-Modified' => gmdate("D, d M Y H:i:s") . " GMT",
|
||||
'Cache-Control' => 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0',
|
||||
'Pragma' => 'no-cache'
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -199,4 +199,20 @@ class CakeRequestTestCase extends CakeTestCase {
|
|||
->method('_sendHeader')->with('Location', 'http://www.example.com');
|
||||
$response->send();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the disableCache method
|
||||
*
|
||||
*/
|
||||
public function testDisableCache() {
|
||||
$response = new CakeResponse();
|
||||
$expected = array(
|
||||
'Expires' => 'Mon, 26 Jul 1997 05:00:00 GMT',
|
||||
'Last-Modified' => gmdate("D, d M Y H:i:s") . " GMT",
|
||||
'Cache-Control' => 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0',
|
||||
'Pragma' => 'no-cache'
|
||||
);
|
||||
$response->disableCache();
|
||||
$this->assertEquals($response->header(), $expected);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue