Added SoapClientBuilder::withCompression()

This commit is contained in:
Francis Besset 2011-10-11 22:39:55 +02:00
parent d6c9074c94
commit 004d88f564
2 changed files with 21 additions and 0 deletions

View File

@ -77,6 +77,16 @@ class SoapClientBuilder extends AbstractSoapBuilder
return $this;
}
public function withCompressionGzip()
{
$this->soapOptions['compression'] = SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP;
}
public function withCompressionDeflate()
{
$this->soapOptions['compression'] = SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_DEFLATE;
}
/**
* @return SoapClientBuilder
*/

View File

@ -62,6 +62,17 @@ class SoapClientBuilderTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($this->mergeOptions(array('user_agent' => 'BeSimpleSoap Test')), $builder->getSoapOptions());
}
public function testWithCompression()
{
$builder = $this->getSoapBuilder();
$builder->withCompressionGzip();
$this->assertEquals($this->mergeOptions(array('compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP)), $builder->getSoapOptions());
$builder->withCompressionDeflate();
$this->assertEquals($this->mergeOptions(array('compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_DEFLATE)), $builder->getSoapOptions());
}
public function testWithAuthentication()
{
$builder = $this->getSoapBuilder();