Przeglądaj źródła

fixed a unit test and CS

Fabien Potencier 14 lat temu
rodzic
commit
9714524b39

+ 2 - 2
src/Symfony/Component/HttpFoundation/Cookie.php

@@ -60,13 +60,13 @@ class Cookie
         $this->secure = (Boolean) $secure;
         $this->httpOnly = (Boolean) $httpOnly;
     }
-    
+
     public function __toString()
     {
         $str = urlencode($this->getName()).'=';
 
         if ('' === (string) $this->getValue()) {
-            $str .= 'deleted; expires='.gmdate("D, d-M-Y H:i:s T", time()-31536001);
+            $str .= 'deleted; expires='.gmdate("D, d-M-Y H:i:s T", time() - 31536001);
         } else {
             $str .= urlencode($this->getValue());
 

+ 1 - 3
src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php

@@ -44,9 +44,7 @@ class ResponseHeaderBag extends HeaderBag
             $cookies .= 'Set-Cookie: '.$cookie."\r\n";
         }
 
-        return
-            parent::__toString().
-            $cookies;
+        return parent::__toString().$cookies;
     }
 
     /**

+ 4 - 4
tests/Symfony/Tests/Component/HttpFoundation/ResponseHeaderBagTest.php

@@ -63,16 +63,16 @@ class ResponseHeaderBagTest extends \PHPUnit_Framework_TestCase
         $bag->set('Last-Modified', 'abcde');
         $this->assertEquals('private, must-revalidate', $bag->get('Cache-Control'));
     }
-    
+
     public function testToStringIncludesCookieHeaders()
     {
         $bag = new ResponseHeaderBag(array());
         $bag->setCookie(new Cookie('foo', 'bar'));
-        
+
         $this->assertContains("Set-Cookie: foo=bar; path=/; httponly", explode("\r\n", $bag->__toString()));
-        
+
         $bag->clearCookie('foo');
 
-        $this->assertContains("Set-Cookie: foo=deleted; expires=Thu, 01 Jan 1970 00:00:00 GMT; httponly", explode("\r\n", $bag->__toString()));
+        $this->assertContains("Set-Cookie: foo=deleted; expires=".gmdate("D, d-M-Y H:i:s T", time() - 31536001)."; httponly", explode("\r\n", $bag->__toString()));
     }
 }