Skip to content
Permalink
Browse files

Improving the CakeResponse::cache() method

  • Loading branch information...
lorenzo committed Oct 3, 2010
1 parent d117300 commit bf22928b6acdc074f9b9a0128286727412eaafdc
Showing with 5 additions and 1 deletion.
  1. +2 −1 cake/libs/cake_response.php
  2. +3 −0 cake/tests/cases/libs/cake_response.test.php
@@ -614,7 +614,8 @@ public function cache($since, $time = '+1 day') {
$time = strtotime($time);
}
$this->header(array(
'Date' => gmdate("D, j M Y G:i:s ", $since) . 'GMT',
'Date' => gmdate("D, j M Y G:i:s ", time()) . 'GMT',
'Last-Modified' => gmdate("D, j M Y G:i:s ", $since) . 'GMT',
'Expires' => gmdate("D, j M Y H:i:s", $time) . " GMT",
'Cache-Control' => 'public, max-age=' . ($time - time()),
'Pragma' => 'cache'
@@ -230,6 +230,7 @@ public function testCache() {
$time = '+1 day';
$expected = array(
'Date' => gmdate("D, j M Y G:i:s ", $since) . 'GMT',
'Last-Modified' => gmdate("D, j M Y G:i:s ", $since) . 'GMT',
'Expires' => gmdate("D, j M Y H:i:s", strtotime($time)) . " GMT",
'Cache-Control' => 'public, max-age=' . (strtotime($time) - time()),
'Pragma' => 'cache'
@@ -242,6 +243,7 @@ public function testCache() {
$time = '+5 day';
$expected = array(
'Date' => gmdate("D, j M Y G:i:s ", $since) . 'GMT',
'Last-Modified' => gmdate("D, j M Y G:i:s ", $since) . 'GMT',
'Expires' => gmdate("D, j M Y H:i:s", strtotime($time)) . " GMT",
'Cache-Control' => 'public, max-age=' . (strtotime($time) - time()),
'Pragma' => 'cache'
@@ -254,6 +256,7 @@ public function testCache() {
$time = time();
$expected = array(
'Date' => gmdate("D, j M Y G:i:s ", $since) . 'GMT',
'Last-Modified' => gmdate("D, j M Y G:i:s ", $since) . 'GMT',
'Expires' => gmdate("D, j M Y H:i:s", $time) . " GMT",
'Cache-Control' => 'public, max-age=0',
'Pragma' => 'cache'

0 comments on commit bf22928

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