Skip to content

Commit

Permalink
Added SoapOptions test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bilge committed Jun 17, 2016
1 parent 09e2d7e commit abc3c7e
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions test/Unit/Porter/Connector/Soap/SoapOptionsTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php
namespace ScriptFUSIONTest\Unit\Porter\Connector\Soap;

use ScriptFUSION\Porter\Connector\Soap\SoapOptions;

final class SoapOptionsTest extends \PHPUnit_Framework_TestCase
{
public function testOptionDefaults()
{
$options = new SoapOptions;

self::assertSame([], $options->getParameters());
self::assertNull($options->getVersion());
self::assertNull($options->getCompression());
self::assertNull($options->getKeepAlive());
}

public function testParameters()
{
$options = (new SoapOptions)->setParameters($params = ['foo' => 'bar']);

self::assertSame($params, $options->getParameters());
}

public function testVersion()
{
$options = (new SoapOptions)->setVersion(SOAP_1_2);

self::assertSame(SOAP_1_2, $options->getVersion());
}

public function testCompression()
{
$options = (new SoapOptions)->setCompression(SOAP_COMPRESSION_ACCEPT);

self::assertSame(SOAP_COMPRESSION_ACCEPT, $options->getCompression());
}

public function testKeepAlive()
{
$options = (new SoapOptions)->setKeepAlive(true);

self::assertTrue($options->getKeepAlive());
self::assertFalse($options->setKeepAlive(false)->getKeepAlive());
}

public function testExtractSoapClientOptions()
{
$options = new SoapOptions;
self::assertSame([], $options->extractSoapClientOptions());

$options
->setParameters($params = ['foo', 'bar'])
->setVersion(SOAP_1_1)
->setCompression(SOAP_COMPRESSION_DEFLATE)
->setKeepAlive(false);

self::assertSame([
'soap_version' => SOAP_1_1,
'compression' => SOAP_COMPRESSION_DEFLATE,
'keep_alive' => false,
], $options->extractSoapClientOptions());
}
}

0 comments on commit abc3c7e

Please sign in to comment.