1
0
Fork 0

Fix StreamContextFactory tests

pull/1238/merge
Jordi Boggiano 2012-10-21 17:57:16 +02:00
parent 39e69a3b12
commit 7aab7c6297
2 changed files with 5 additions and 5 deletions

View File

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

View File

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