[SoapClient] Added Classmap
This commit is contained in:
@ -13,6 +13,7 @@
|
||||
namespace BeSimple\Tests\SoapClient;
|
||||
|
||||
use BeSimple\SoapCommon\Cache;
|
||||
use BeSimple\SoapCommon\Classmap;
|
||||
use BeSimple\SoapCommon\Converter\DateTimeTypeConverter;
|
||||
use BeSimple\SoapCommon\Converter\DateTypeConverter;
|
||||
use BeSimple\SoapCommon\Converter\TypeConverterCollection;
|
||||
@ -88,10 +89,29 @@ class SoapClientTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
Cache::setType(Cache::TYPE_MEMORY);
|
||||
$soapClient = new SoapClient('foo.wsdl', array('debug' => true));
|
||||
$this->assertEquals(array('cache_wsdl' => Cache::getType(), 'trace' => true, 'typemap' => array()), $soapClient->getSoapOptions());
|
||||
$this->assertEquals(array('cache_wsdl' => Cache::getType(), 'trace' => true, 'classmap' => array(), 'typemap' => array()), $soapClient->getSoapOptions());
|
||||
|
||||
$soapClient = new SoapClient('foo.wsdl', array('debug' => false, 'cache_type' => Cache::TYPE_NONE));
|
||||
$this->assertEquals(array('cache_wsdl' => Cache::TYPE_NONE, 'trace' => false, 'typemap' => array()), $soapClient->getSoapOptions());
|
||||
$this->assertEquals(array('cache_wsdl' => Cache::TYPE_NONE, 'trace' => false, 'classmap' => array(), 'typemap' => array()), $soapClient->getSoapOptions());
|
||||
}
|
||||
|
||||
public function testGetSoapOptionsWithClassmap()
|
||||
{
|
||||
$classmap = new Classmap();
|
||||
|
||||
$soapClient = new SoapClient('foo.wsdl', array(), $classmap);
|
||||
$soapOptions = $soapClient->getSoapOptions();
|
||||
|
||||
$this->assertSame(array(), $soapOptions['classmap']);
|
||||
|
||||
$map = array(
|
||||
'foobar' => 'BeSimple\SoapClient\SoapClient',
|
||||
'barfoo' => 'BeSimple\SoapClient\Tests\SoapClientTest',
|
||||
);
|
||||
$classmap->set($map);
|
||||
$soapOptions = $soapClient->getSoapOptions();
|
||||
|
||||
$this->assertSame($map, $soapOptions['classmap']);
|
||||
}
|
||||
|
||||
public function testGetSoapOptionsWithTypemap()
|
||||
@ -104,7 +124,7 @@ class SoapClientTest extends \PHPUnit_Framework_TestCase
|
||||
$dateTypeConverter = new DateTypeConverter();
|
||||
$converters->add($dateTypeConverter);
|
||||
|
||||
$soapClient = new SoapClient('foo.wsdl', array(), $converters);
|
||||
$soapClient = new SoapClient('foo.wsdl', array(), null, $converters);
|
||||
$soapOptions = $soapClient->getSoapOptions();
|
||||
|
||||
$this->assertEquals('http://www.w3.org/2001/XMLSchema', $soapOptions['typemap'][0]['type_ns']);
|
||||
|
Reference in New Issue
Block a user