@@ -271,7 +271,7 @@ public function testCache() {
271
271
$ response ->expires ('+1 day ' );
272
272
$ expected = array (
273
273
'Date ' => gmdate ("D, j M Y G:i:s " , $ since ) . 'GMT ' ,
274
- 'Last-Modified ' => gmdate ("D, j M Y G :i:s " , $ since ) . 'GMT ' ,
274
+ 'Last-Modified ' => gmdate ("D, j M Y H :i:s " , $ since ) . 'GMT ' ,
275
275
'Expires ' => $ time ->format ('D, j M Y H:i:s ' ) . ' GMT ' ,
276
276
'Cache-Control ' => 'public, max-age= ' . ($ time ->format ('U ' ) - time ()),
277
277
'Pragma ' => 'cache '
@@ -284,7 +284,7 @@ public function testCache() {
284
284
$ time = '+5 day ' ;
285
285
$ expected = array (
286
286
'Date ' => gmdate ("D, j M Y G:i:s " , $ since ) . 'GMT ' ,
287
- 'Last-Modified ' => gmdate ("D, j M Y G :i:s " , $ since ) . 'GMT ' ,
287
+ 'Last-Modified ' => gmdate ("D, j M Y H :i:s " , $ since ) . 'GMT ' ,
288
288
'Expires ' => gmdate ("D, j M Y H:i:s " , strtotime ($ time )) . " GMT " ,
289
289
'Cache-Control ' => 'public, max-age= ' . (strtotime ($ time ) - time ()),
290
290
'Pragma ' => 'cache '
@@ -297,7 +297,7 @@ public function testCache() {
297
297
$ time = time ();
298
298
$ expected = array (
299
299
'Date ' => gmdate ("D, j M Y G:i:s " , $ since ) . 'GMT ' ,
300
- 'Last-Modified ' => gmdate ("D, j M Y G :i:s " , $ since ) . 'GMT ' ,
300
+ 'Last-Modified ' => gmdate ("D, j M Y H :i:s " , $ since ) . 'GMT ' ,
301
301
'Expires ' => gmdate ("D, j M Y H:i:s " , $ time ) . " GMT " ,
302
302
'Cache-Control ' => 'public, max-age=0 ' ,
303
303
'Pragma ' => 'cache '
@@ -603,4 +603,36 @@ public function testExpires() {
603
603
->method ('_sendHeader ' )->with ('Expires ' , $ time ->format ('D, j M Y H:i:s ' ) . ' GMT ' );
604
604
$ response ->send ();
605
605
}
606
+
607
+ /**
608
+ * Tests setting the modification date
609
+ *
610
+ * @return void
611
+ */
612
+ public function testModified () {
613
+ $ response = $ this ->getMock ('CakeResponse ' , array ('_sendHeader ' , '_sendContent ' ));
614
+ $ now = new DateTime ('now ' , new DateTimeZone ('America/Los_Angeles ' ));
615
+ $ response ->modified ($ now );
616
+ $ now ->setTimeZone (new DateTimeZone ('UTC ' ));
617
+ $ this ->assertEquals ($ now ->format ('D, j M Y H:i:s ' ) . ' GMT ' , $ response ->modified ());
618
+ $ response ->expects ($ this ->at (1 ))
619
+ ->method ('_sendHeader ' )->with ('Last-Modified ' , $ now ->format ('D, j M Y H:i:s ' ) . ' GMT ' );
620
+ $ response ->send ();
621
+
622
+ $ response = $ this ->getMock ('CakeResponse ' , array ('_sendHeader ' , '_sendContent ' ));
623
+ $ now = time ();
624
+ $ response ->modified ($ now );
625
+ $ this ->assertEquals (gmdate ('D, j M Y H:i:s ' , $ now ) . ' GMT ' , $ response ->modified ());
626
+ $ response ->expects ($ this ->at (1 ))
627
+ ->method ('_sendHeader ' )->with ('Last-Modified ' , gmdate ('D, j M Y H:i:s ' , $ now ) . ' GMT ' );
628
+ $ response ->send ();
629
+
630
+ $ response = $ this ->getMock ('CakeResponse ' , array ('_sendHeader ' , '_sendContent ' ));
631
+ $ time = new DateTime ('+1 day ' , new DateTimeZone ('UTC ' ));
632
+ $ response ->modified ('+1 day ' );
633
+ $ this ->assertEquals ($ time ->format ('D, j M Y H:i:s ' ) . ' GMT ' , $ response ->modified ());
634
+ $ response ->expects ($ this ->at (1 ))
635
+ ->method ('_sendHeader ' )->with ('Last-Modified ' , $ time ->format ('D, j M Y H:i:s ' ) . ' GMT ' );
636
+ $ response ->send ();
637
+ }
606
638
}
0 commit comments