Updated SoapClientBuilder

This commit is contained in:
Francis Besset 2011-10-10 00:02:20 +02:00
parent 28ed21530d
commit 46ced393ca
2 changed files with 12 additions and 13 deletions

View File

@ -19,9 +19,6 @@ use BeSimple\SoapCommon\AbstractSoapBuilder;
*/
class SoapClientBuilder extends AbstractSoapBuilder
{
protected $wsdl;
protected $options;
/**
* @return SoapClientBuilder
*/
@ -34,21 +31,21 @@ class SoapClientBuilder extends AbstractSoapBuilder
public function withTrace($trace = true)
{
$this->options['trace'] = $trace;
$this->soapOptions['trace'] = $trace;
return $this;
}
public function withExceptions($exceptions = true)
{
$this->options['exceptions'] = $exceptions;
$this->soapOptions['exceptions'] = $exceptions;
return $this;
}
public function withUserAgent($userAgent)
{
$this->options['user_agent'] = $userAgent;
$this->soapOptions['user_agent'] = $userAgent;
return $this;
}

View File

@ -18,13 +18,15 @@ class SoapClientBuilderTest extends \PHPUnit_Framework_TestCase
{
private $defaultOptions = array(
'features' => 0,
'classmap' => array(),
'typemap' => array(),
);
public function testContruct()
{
$options = $this
->getSoapBuilder()
->getOptions()
->getSoapOptions()
;
$this->assertEquals($this->mergeOptions(array()), $options);
@ -35,10 +37,10 @@ class SoapClientBuilderTest extends \PHPUnit_Framework_TestCase
$builder = $this->getSoapBuilder();
$builder->withTrace();
$this->assertEquals($this->mergeOptions(array('trace' => true)), $builder->getOptions());
$this->assertEquals($this->mergeOptions(array('trace' => true)), $builder->getSoapOptions());
$builder->withTrace(false);
$this->assertEquals($this->mergeOptions(array('trace' => false)), $builder->getOptions());
$this->assertEquals($this->mergeOptions(array('trace' => false)), $builder->getSoapOptions());
}
public function testWithExceptions()
@ -46,10 +48,10 @@ class SoapClientBuilderTest extends \PHPUnit_Framework_TestCase
$builder = $this->getSoapBuilder();
$builder->withExceptions();
$this->assertEquals($this->mergeOptions(array('exceptions' => true)), $builder->getOptions());
$this->assertEquals($this->mergeOptions(array('exceptions' => true)), $builder->getSoapOptions());
$builder->withExceptions(false);
$this->assertEquals($this->mergeOptions(array('exceptions' => false)), $builder->getOptions());
$this->assertEquals($this->mergeOptions(array('exceptions' => false)), $builder->getSoapOptions());
}
public function testWithUserAgent()
@ -57,7 +59,7 @@ class SoapClientBuilderTest extends \PHPUnit_Framework_TestCase
$builder = $this->getSoapBuilder();
$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()
@ -66,7 +68,7 @@ class SoapClientBuilderTest extends \PHPUnit_Framework_TestCase
$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()