[SoapClient] Renamed proxy_user to proxy_login option to keep compatibility with SoapClient of PHP

This commit is contained in:
Francis Besset 2014-08-18 10:58:40 +02:00
parent 960c9f557a
commit 70db0c42fd
3 changed files with 8 additions and 8 deletions

View File

@ -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']);
}
}

View File

@ -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;

View File

@ -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()