diff --git a/cake/libs/cake_response.php b/cake/libs/cake_response.php index 3f77dd824..12eecbeb0 100644 --- a/cake/libs/cake_response.php +++ b/cake/libs/cake_response.php @@ -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' + )); } /** diff --git a/cake/tests/cases/libs/cake_response.test.php b/cake/tests/cases/libs/cake_response.test.php index b992586b4..4bbf1edc7 100644 --- a/cake/tests/cases/libs/cake_response.test.php +++ b/cake/tests/cases/libs/cake_response.test.php @@ -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); + } } \ No newline at end of file