فهرست منبع

requestTest, override globals erase for the next tests. so backup it and restore it.

Cyril Quintin 14 سال پیش
والد
کامیت
1e4e899641
1فایلهای تغییر یافته به همراه6 افزوده شده و 3 حذف شده
  1. 6 3
      tests/Symfony/Tests/Component/HttpFoundation/RequestTest.php

+ 6 - 3
tests/Symfony/Tests/Component/HttpFoundation/RequestTest.php

@@ -507,10 +507,12 @@ class RequestTest extends \PHPUnit_Framework_TestCase
 
     public function testOverrideGlobals()
     {
-        $time = $_SERVER['REQUEST_TIME']; // fix for phpunit timer
-
         $request = new Request();
         $request->initialize(array('foo' => 'bar'));
+
+        // as the Request::overrideGlobals really work, it erase $_SERVER, so we must backup it
+        $server = $_SERVER;
+
         $request->overrideGlobals();
 
         $this->assertEquals(array('foo' => 'bar'), $_GET);
@@ -530,7 +532,8 @@ class RequestTest extends \PHPUnit_Framework_TestCase
 
         $this->assertArrayHasKey('HTTP_X_FORWARDED_PROTO', $_SERVER);
 
-        $_SERVER['REQUEST_TIME'] = $time; // fix for phpunit timer
+        // restore initial $_SERVER array
+        $_SERVER = $server;
     }
 
     public function testGetScriptName()