Browse Source

Fix StreamContextFactory tests

Jordi Boggiano 12 years ago
parent
commit
7aab7c6297

+ 1 - 1
src/Composer/Util/StreamContextFactory.php

@@ -72,7 +72,7 @@ final class StreamContextFactory
                 if (isset($defaultOptions['http']['header'])) {
                     $defaultOptions['http']['header'][] = "Proxy-Authorization: Basic {$auth}";
                 } else {
-                    $options['http']['header'] = "Proxy-Authorization: Basic {$auth}\r\n";
+                    $options['http']['header'] = array("Proxy-Authorization: Basic {$auth}");
                 }
             }
         }

+ 4 - 4
tests/Composer/Test/Util/StreamContextFactoryTest.php

@@ -67,7 +67,7 @@ class StreamContextFactoryTest extends \PHPUnit_Framework_TestCase
             'proxy' => 'tcp://proxyserver.net:3128',
             'request_fulluri' => true,
             'method' => 'GET',
-            'header' => "Proxy-Authorization: Basic " . base64_encode('username:password') . "\r\n"
+            'header' => array("Proxy-Authorization: Basic " . base64_encode('username:password'))
         )), $options);
     }
 
@@ -75,14 +75,14 @@ class StreamContextFactoryTest extends \PHPUnit_Framework_TestCase
     {
         $_SERVER['http_proxy'] = 'http://username:password@proxyserver.net:3128/';
 
-        $context = StreamContextFactory::getContext(array('http' => array('method' => 'GET', 'header' => "X-Foo: bar\r\n", 'request_fulluri' => false)));
+        $context = StreamContextFactory::getContext(array('http' => array('method' => 'GET', 'header' => array("X-Foo: bar"), 'request_fulluri' => false)));
         $options = stream_context_get_options($context);
 
         $this->assertEquals(array('http' => array(
             'proxy' => 'tcp://proxyserver.net:3128',
             'request_fulluri' => false,
             'method' => 'GET',
-            'header' => "X-Foo: bar\r\nProxy-Authorization: Basic " . base64_encode('username:password') . "\r\n"
+            'header' => array("X-Foo: bar", "Proxy-Authorization: Basic " . base64_encode('username:password'))
         )), $options);
     }
 
@@ -97,7 +97,7 @@ class StreamContextFactoryTest extends \PHPUnit_Framework_TestCase
             'proxy' => 'tcp://proxyserver.net:80',
             'request_fulluri' => true,
             'method' => 'GET',
-            'header' => "Proxy-Authorization: Basic " . base64_encode('username:password') . "\r\n"
+            'header' => array("Proxy-Authorization: Basic " . base64_encode('username:password'))
         )), $options);
     }