Added typemap and classmap in AbstractSoapBuilder

This commit is contained in:
Francis Besset
2011-10-09 23:53:58 +02:00
parent 676d5cb108
commit c243957bdf
2 changed files with 93 additions and 33 deletions

View File

@ -19,13 +19,15 @@ class AbstractSoapBuilderTest 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);
@ -45,10 +47,10 @@ class AbstractSoapBuilderTest extends \PHPUnit_Framework_TestCase
$builder = $this->getSoapBuilder();
$builder->withSoapVersion11();
$this->assertEquals($this->mergeOptions(array('soap_version' => SOAP_1_1)), $builder->getOptions());
$this->assertEquals($this->mergeOptions(array('soap_version' => SOAP_1_1)), $builder->getSoapOptions());
$builder->withSoapVersion12();
$this->assertEquals($this->mergeOptions(array('soap_version' => SOAP_1_2)), $builder->getOptions());
$this->assertEquals($this->mergeOptions(array('soap_version' => SOAP_1_2)), $builder->getSoapOptions());
}
public function testWithEncoding()
@ -58,7 +60,7 @@ class AbstractSoapBuilderTest extends \PHPUnit_Framework_TestCase
->withEncoding('ISO 8859-15')
;
$this->assertEquals($this->mergeOptions(array('encoding' => 'ISO 8859-15')), $builder->getOptions());
$this->assertEquals($this->mergeOptions(array('encoding' => 'ISO 8859-15')), $builder->getSoapOptions());
}
public function testWithWsdlCache()
@ -66,16 +68,16 @@ class AbstractSoapBuilderTest extends \PHPUnit_Framework_TestCase
$builder = $this->getSoapBuilder();
$builder->withWsdlCacheNone();
$this->assertEquals($this->mergeOptions(array('cache_wsdl' => Cache::TYPE_NONE)), $builder->getOptions());
$this->assertEquals($this->mergeOptions(array('cache_wsdl' => Cache::TYPE_NONE)), $builder->getSoapOptions());
$builder->withWsdlCacheDisk();
$this->assertEquals($this->mergeOptions(array('cache_wsdl' => Cache::TYPE_DISK)), $builder->getOptions());
$this->assertEquals($this->mergeOptions(array('cache_wsdl' => Cache::TYPE_DISK)), $builder->getSoapOptions());
$builder->withWsdlCacheMemory();
$this->assertEquals($this->mergeOptions(array('cache_wsdl' => Cache::TYPE_MEMORY)), $builder->getOptions());
$this->assertEquals($this->mergeOptions(array('cache_wsdl' => Cache::TYPE_MEMORY)), $builder->getSoapOptions());
$builder->withWsdlCacheDiskAndMemory();
$this->assertEquals($this->mergeOptions(array('cache_wsdl' => Cache::TYPE_DISK_MEMORY)), $builder->getOptions());
$this->assertEquals($this->mergeOptions(array('cache_wsdl' => Cache::TYPE_DISK_MEMORY)), $builder->getSoapOptions());
}
public function testWithSingleElementArrays()
@ -83,7 +85,7 @@ class AbstractSoapBuilderTest extends \PHPUnit_Framework_TestCase
$options = $this
->getSoapBuilder()
->withSingleElementArrays()
->getOptions()
->getSoapOptions()
;
$this->assertEquals($this->mergeOptions(array('features' => SOAP_SINGLE_ELEMENT_ARRAYS)), $options);
@ -94,7 +96,7 @@ class AbstractSoapBuilderTest extends \PHPUnit_Framework_TestCase
$options = $this
->getSoapBuilder()
->withWaitOneWayCalls()
->getOptions()
->getSoapOptions()
;
$this->assertEquals($this->mergeOptions(array('features' => SOAP_WAIT_ONE_WAY_CALLS)), $options);
@ -105,7 +107,7 @@ class AbstractSoapBuilderTest extends \PHPUnit_Framework_TestCase
$options = $this
->getSoapBuilder()
->withUseXsiArrayType()
->getOptions()
->getSoapOptions()
;
$this->assertEquals($this->mergeOptions(array('features' => SOAP_USE_XSI_ARRAY_TYPE)), $options);
@ -118,15 +120,15 @@ class AbstractSoapBuilderTest extends \PHPUnit_Framework_TestCase
$builder->withSingleElementArrays();
$features |= SOAP_SINGLE_ELEMENT_ARRAYS;
$this->assertEquals($this->mergeOptions(array('features' => $features)), $builder->getOptions());
$this->assertEquals($this->mergeOptions(array('features' => $features)), $builder->getSoapOptions());
$builder->withWaitOneWayCalls();
$features |= SOAP_WAIT_ONE_WAY_CALLS;
$this->assertEquals($this->mergeOptions(array('features' => $features)), $builder->getOptions());
$this->assertEquals($this->mergeOptions(array('features' => $features)), $builder->getSoapOptions());
$builder->withUseXsiArrayType();
$features |= SOAP_USE_XSI_ARRAY_TYPE;
$this->assertEquals($this->mergeOptions(array('features' => $features)), $builder->getOptions());
$this->assertEquals($this->mergeOptions(array('features' => $features)), $builder->getSoapOptions());
}
public function testCreateWithDefaults()
@ -135,7 +137,7 @@ class AbstractSoapBuilderTest extends \PHPUnit_Framework_TestCase
$this->assertInstanceOf('BeSimple\Tests\SoapCommon\Fixtures\SoapBuilder', $builder);
$this->assertEquals($this->mergeOptions(array('soap_version' => SOAP_1_2, 'encoding' => 'UTF-8', 'features' => SOAP_SINGLE_ELEMENT_ARRAYS)), $builder->getOptions());
$this->assertEquals($this->mergeOptions(array('soap_version' => SOAP_1_2, 'encoding' => 'UTF-8', 'features' => SOAP_SINGLE_ELEMENT_ARRAYS)), $builder->getSoapOptions());
}
private function getSoapBuilder()