Skip to content
Permalink
Browse files

Implementing CakeResponse::disableCache()

  • Loading branch information...
lorenzo committed Jul 31, 2010
1 parent 20d1e48 commit 5ba0e43aa3b6914e61f5bdfa6f3454ea04106b1a
Showing with 22 additions and 1 deletion.
  1. +6 −1 cake/libs/cake_response.php
  2. +16 −0 cake/tests/cases/libs/cake_response.test.php
@@ -493,7 +493,12 @@ public function charset($charset = null) {
* @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 @@ public function testSendWithLocation() {
->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);
}
}

0 comments on commit 5ba0e43

Please sign in to comment.
You can’t perform that action at this time.