Updated SoapClientBuilder
This commit is contained in:
parent
28ed21530d
commit
46ced393ca
@ -19,9 +19,6 @@ use BeSimple\SoapCommon\AbstractSoapBuilder;
|
|||||||
*/
|
*/
|
||||||
class SoapClientBuilder extends AbstractSoapBuilder
|
class SoapClientBuilder extends AbstractSoapBuilder
|
||||||
{
|
{
|
||||||
protected $wsdl;
|
|
||||||
protected $options;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return SoapClientBuilder
|
* @return SoapClientBuilder
|
||||||
*/
|
*/
|
||||||
@ -34,21 +31,21 @@ class SoapClientBuilder extends AbstractSoapBuilder
|
|||||||
|
|
||||||
public function withTrace($trace = true)
|
public function withTrace($trace = true)
|
||||||
{
|
{
|
||||||
$this->options['trace'] = $trace;
|
$this->soapOptions['trace'] = $trace;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function withExceptions($exceptions = true)
|
public function withExceptions($exceptions = true)
|
||||||
{
|
{
|
||||||
$this->options['exceptions'] = $exceptions;
|
$this->soapOptions['exceptions'] = $exceptions;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function withUserAgent($userAgent)
|
public function withUserAgent($userAgent)
|
||||||
{
|
{
|
||||||
$this->options['user_agent'] = $userAgent;
|
$this->soapOptions['user_agent'] = $userAgent;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -18,13 +18,15 @@ class SoapClientBuilderTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
private $defaultOptions = array(
|
private $defaultOptions = array(
|
||||||
'features' => 0,
|
'features' => 0,
|
||||||
|
'classmap' => array(),
|
||||||
|
'typemap' => array(),
|
||||||
);
|
);
|
||||||
|
|
||||||
public function testContruct()
|
public function testContruct()
|
||||||
{
|
{
|
||||||
$options = $this
|
$options = $this
|
||||||
->getSoapBuilder()
|
->getSoapBuilder()
|
||||||
->getOptions()
|
->getSoapOptions()
|
||||||
;
|
;
|
||||||
|
|
||||||
$this->assertEquals($this->mergeOptions(array()), $options);
|
$this->assertEquals($this->mergeOptions(array()), $options);
|
||||||
@ -35,10 +37,10 @@ class SoapClientBuilderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$builder = $this->getSoapBuilder();
|
$builder = $this->getSoapBuilder();
|
||||||
|
|
||||||
$builder->withTrace();
|
$builder->withTrace();
|
||||||
$this->assertEquals($this->mergeOptions(array('trace' => true)), $builder->getOptions());
|
$this->assertEquals($this->mergeOptions(array('trace' => true)), $builder->getSoapOptions());
|
||||||
|
|
||||||
$builder->withTrace(false);
|
$builder->withTrace(false);
|
||||||
$this->assertEquals($this->mergeOptions(array('trace' => false)), $builder->getOptions());
|
$this->assertEquals($this->mergeOptions(array('trace' => false)), $builder->getSoapOptions());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWithExceptions()
|
public function testWithExceptions()
|
||||||
@ -46,10 +48,10 @@ class SoapClientBuilderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$builder = $this->getSoapBuilder();
|
$builder = $this->getSoapBuilder();
|
||||||
|
|
||||||
$builder->withExceptions();
|
$builder->withExceptions();
|
||||||
$this->assertEquals($this->mergeOptions(array('exceptions' => true)), $builder->getOptions());
|
$this->assertEquals($this->mergeOptions(array('exceptions' => true)), $builder->getSoapOptions());
|
||||||
|
|
||||||
$builder->withExceptions(false);
|
$builder->withExceptions(false);
|
||||||
$this->assertEquals($this->mergeOptions(array('exceptions' => false)), $builder->getOptions());
|
$this->assertEquals($this->mergeOptions(array('exceptions' => false)), $builder->getSoapOptions());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWithUserAgent()
|
public function testWithUserAgent()
|
||||||
@ -57,7 +59,7 @@ class SoapClientBuilderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$builder = $this->getSoapBuilder();
|
$builder = $this->getSoapBuilder();
|
||||||
|
|
||||||
$builder->withUserAgent('BeSimpleSoap Test');
|
$builder->withUserAgent('BeSimpleSoap Test');
|
||||||
$this->assertEquals($this->mergeOptions(array('user_agent' => 'BeSimpleSoap Test')), $builder->getOptions());
|
$this->assertEquals($this->mergeOptions(array('user_agent' => 'BeSimpleSoap Test')), $builder->getSoapOptions());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCreateWithDefaults()
|
public function testCreateWithDefaults()
|
||||||
@ -66,7 +68,7 @@ class SoapClientBuilderTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$this->assertInstanceOf('BeSimple\SoapClient\SoapClientBuilder', $builder);
|
$this->assertInstanceOf('BeSimple\SoapClient\SoapClientBuilder', $builder);
|
||||||
|
|
||||||
$this->assertEquals($this->mergeOptions(array('soap_version' => SOAP_1_2, 'encoding' => 'UTF-8', 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, 'user_agent' => 'BeSimpleSoap')), $builder->getOptions());
|
$this->assertEquals($this->mergeOptions(array('soap_version' => SOAP_1_2, 'encoding' => 'UTF-8', 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, 'user_agent' => 'BeSimpleSoap')), $builder->getSoapOptions());
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getSoapBuilder()
|
private function getSoapBuilder()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user