From 70db0c42fd38d3c5ccb698119d65c32f821968fa Mon Sep 17 00:00:00 2001 From: Francis Besset Date: Mon, 18 Aug 2014 10:58:40 +0200 Subject: [PATCH] [SoapClient] Renamed proxy_user to proxy_login option to keep compatibility with SoapClient of PHP --- src/BeSimple/SoapClient/Curl.php | 4 ++-- src/BeSimple/SoapClient/SoapClientBuilder.php | 10 +++++----- .../SoapClient/Tests/SoapClientBuilderTest.php | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/BeSimple/SoapClient/Curl.php b/src/BeSimple/SoapClient/Curl.php index 8bc814b..272f717 100644 --- a/src/BeSimple/SoapClient/Curl.php +++ b/src/BeSimple/SoapClient/Curl.php @@ -90,8 +90,8 @@ class Curl curl_setopt($this->ch, CURLOPT_PROXY, $proxyHost); - if ($proxyHost && isset($options['proxy_user'])) { - curl_setopt($this->ch, CURLOPT_PROXYUSERPWD, $options['proxy_user'].':'.$options['proxy_pass']); + if (false !== $proxyHost && isset($options['proxy_login'])) { + curl_setopt($this->ch, CURLOPT_PROXYUSERPWD, $options['proxy_login'].':'.$options['proxy_password']); } } diff --git a/src/BeSimple/SoapClient/SoapClientBuilder.php b/src/BeSimple/SoapClient/SoapClientBuilder.php index a01463f..910d718 100644 --- a/src/BeSimple/SoapClient/SoapClientBuilder.php +++ b/src/BeSimple/SoapClient/SoapClientBuilder.php @@ -175,19 +175,19 @@ class SoapClientBuilder extends AbstractSoapBuilder * * @param string $host Host * @param int $port Port - * @param string $username Username + * @param string $login Login * @param string $password Password * * @return \BeSimple\SoapClient\SoapClientBuilder */ - public function withProxy($host, $port, $user = null, $pass = null) + public function withProxy($host, $port, $login = null, $password = null) { $this->soapOptions['proxy_host'] = $host; $this->soapOptions['proxy_port'] = $port; - if ($user) { - $this->soapOptions['proxy_user'] = $user; - $this->soapOptions['proxy_pass'] = $pass; + if ($login) { + $this->soapOptions['proxy_login'] = $login; + $this->soapOptions['proxy_password'] = $password; } return $this; diff --git a/src/BeSimple/SoapClient/Tests/SoapClientBuilderTest.php b/src/BeSimple/SoapClient/Tests/SoapClientBuilderTest.php index 271f390..a0ebfeb 100644 --- a/src/BeSimple/SoapClient/Tests/SoapClientBuilderTest.php +++ b/src/BeSimple/SoapClient/Tests/SoapClientBuilderTest.php @@ -95,7 +95,7 @@ class SoapClientBuilderTest extends \PHPUnit_Framework_TestCase $this->assertEquals($this->mergeOptions(array('proxy_host' => 'localhost', 'proxy_port' => 8080)), $builder->getSoapOptions()); $builder->withProxy('127.0.0.1', 8585, 'foo', 'bar'); - $this->assertEquals($this->mergeOptions(array('proxy_host' => '127.0.0.1', 'proxy_port' => 8585, 'proxy_user' => 'foo', 'proxy_pass' => 'bar')), $builder->getSoapOptions()); + $this->assertEquals($this->mergeOptions(array('proxy_host' => '127.0.0.1', 'proxy_port' => 8585, 'proxy_login' => 'foo', 'proxy_password' => 'bar')), $builder->getSoapOptions()); } public function testCreateWithDefaults()