Security update for Core, with self-updated composer
[yaffs-website] / vendor / symfony / http-foundation / Tests / ResponseHeaderBagTest.php
index debcdc1faf16db7b5f6a34dd3534d8d402b3f248..95284e21e497f798593f3f7af66457f3f3b2dc25 100644 (file)
@@ -35,7 +35,7 @@ class ResponseHeaderBagTest extends TestCase
         return array(
             array(
                 array('fOo' => 'BAR'),
-                array('fOo' => array('BAR'), 'Cache-Control' => array('no-cache')),
+                array('fOo' => array('BAR'), 'Cache-Control' => array('no-cache, private')),
             ),
             array(
                 array('ETag' => 'xyzzy'),
@@ -43,23 +43,23 @@ class ResponseHeaderBagTest extends TestCase
             ),
             array(
                 array('Content-MD5' => 'Q2hlY2sgSW50ZWdyaXR5IQ=='),
-                array('Content-MD5' => array('Q2hlY2sgSW50ZWdyaXR5IQ=='), 'Cache-Control' => array('no-cache')),
+                array('Content-MD5' => array('Q2hlY2sgSW50ZWdyaXR5IQ=='), 'Cache-Control' => array('no-cache, private')),
             ),
             array(
                 array('P3P' => 'CP="CAO PSA OUR"'),
-                array('P3P' => array('CP="CAO PSA OUR"'), 'Cache-Control' => array('no-cache')),
+                array('P3P' => array('CP="CAO PSA OUR"'), 'Cache-Control' => array('no-cache, private')),
             ),
             array(
                 array('WWW-Authenticate' => 'Basic realm="WallyWorld"'),
-                array('WWW-Authenticate' => array('Basic realm="WallyWorld"'), 'Cache-Control' => array('no-cache')),
+                array('WWW-Authenticate' => array('Basic realm="WallyWorld"'), 'Cache-Control' => array('no-cache, private')),
             ),
             array(
                 array('X-UA-Compatible' => 'IE=edge,chrome=1'),
-                array('X-UA-Compatible' => array('IE=edge,chrome=1'), 'Cache-Control' => array('no-cache')),
+                array('X-UA-Compatible' => array('IE=edge,chrome=1'), 'Cache-Control' => array('no-cache, private')),
             ),
             array(
                 array('X-XSS-Protection' => '1; mode=block'),
-                array('X-XSS-Protection' => array('1; mode=block'), 'Cache-Control' => array('no-cache')),
+                array('X-XSS-Protection' => array('1; mode=block'), 'Cache-Control' => array('no-cache, private')),
             ),
         );
     }
@@ -67,7 +67,7 @@ class ResponseHeaderBagTest extends TestCase
     public function testCacheControlHeader()
     {
         $bag = new ResponseHeaderBag(array());
-        $this->assertEquals('no-cache', $bag->get('Cache-Control'));
+        $this->assertEquals('no-cache, private', $bag->get('Cache-Control'));
         $this->assertTrue($bag->hasCacheControlDirective('no-cache'));
 
         $bag = new ResponseHeaderBag(array('Cache-Control' => 'public'));
@@ -112,6 +112,14 @@ class ResponseHeaderBagTest extends TestCase
         $this->assertEquals('private, must-revalidate', $bag->get('Cache-Control'));
     }
 
+    public function testCacheControlClone()
+    {
+        $headers = array('foo' => 'bar');
+        $bag1 = new ResponseHeaderBag($headers);
+        $bag2 = new ResponseHeaderBag($bag1->allPreserveCase());
+        $this->assertEquals($bag1->allPreserveCase(), $bag2->allPreserveCase());
+    }
+
     public function testToStringIncludesCookieHeaders()
     {
         $bag = new ResponseHeaderBag(array());
@@ -136,7 +144,7 @@ class ResponseHeaderBagTest extends TestCase
     public function testReplace()
     {
         $bag = new ResponseHeaderBag(array());
-        $this->assertEquals('no-cache', $bag->get('Cache-Control'));
+        $this->assertEquals('no-cache, private', $bag->get('Cache-Control'));
         $this->assertTrue($bag->hasCacheControlDirective('no-cache'));
 
         $bag->replace(array('Cache-Control' => 'public'));
@@ -147,12 +155,12 @@ class ResponseHeaderBagTest extends TestCase
     public function testReplaceWithRemove()
     {
         $bag = new ResponseHeaderBag(array());
-        $this->assertEquals('no-cache', $bag->get('Cache-Control'));
+        $this->assertEquals('no-cache, private', $bag->get('Cache-Control'));
         $this->assertTrue($bag->hasCacheControlDirective('no-cache'));
 
         $bag->remove('Cache-Control');
         $bag->replace(array());
-        $this->assertEquals('no-cache', $bag->get('Cache-Control'));
+        $this->assertEquals('no-cache, private', $bag->get('Cache-Control'));
         $this->assertTrue($bag->hasCacheControlDirective('no-cache'));
     }