Procházet zdrojové kódy

[HttpFoundation] fixed unit test for previous merge

Fabien Potencier před 14 roky
rodič
revize
1a576552f8

+ 2 - 1
src/Symfony/Component/HttpFoundation/Response.php

@@ -772,12 +772,13 @@ class Response
             $this->headers->set('Content-Type', $this->headers->get('Content-Type').'; charset='.$charset);
         }
     }
-    
+
     protected function fixContentLength()
     {
         if (!$this->headers->has('Content-Length')) {
             $this->headers->set('Content-Length', strlen($this->content));
         }
+
         if ($this->headers->has('Transfer-Encoding')) {
             $this->headers->remove('Content-Length');
         }

+ 4 - 1
tests/Symfony/Tests/Component/HttpFoundation/ResponseTest.php

@@ -184,10 +184,13 @@ class ResponseTest extends \PHPUnit_Framework_TestCase
             ->method('set')
             ->with('Content-Type', 'text/html; charset=UTF-8');
         $headerMock->expects($this->at(1))
+            ->method('set')
+            ->with('Content-Length', '3');
+        $headerMock->expects($this->at(2))
             ->method('set')
             ->with('Content-Type', 'text/html; charset=Foo');
 
-        $response = new Response();
+        $response = new Response('foo');
         $response->headers = $headerMock;
 
         // verify first set()