Fixed bug if a complex type contains a collection

This commit is contained in:
Francis Besset
2012-01-12 11:45:15 +01:00
parent f0031e8923
commit cfe949b781
4 changed files with 72 additions and 5 deletions

View File

@ -115,6 +115,29 @@ class RpcLiteralRequestMessageBinderTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(array('fooBar' => $fooBar), $result);
}
public function testProcessMessageComplexTypeWithArrays()
{
$messageBinder = new RpcLiteralRequestMessageBinder();
$array = array(1, 2, 3, 4);
$stdClass = new \stdClass();
$stdClass->item = $array;
$simpleArrays = new Fixtures\SimpleArrays(null, new \stdClass(), $stdClass);
$result = $messageBinder->processMessage(
new Definition\Method('complextype_with_array', null, array(), array(
new Definition\Argument('simple_arrays', new Definition\Type('BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\SimpleArrays')),
)),
array($simpleArrays),
$this->getDefinitionComplexTypes()
);
$result = $result['simple_arrays'];
$this->assertEquals(array(), $result->array1);
$this->assertEquals(array(), $result->getArray2());
$this->assertEquals($array, $result->getArray3());
}
public function testProcessMessageWithEmptyArrayComplexType()
{
$messageBinder = new RpcLiteralRequestMessageBinder();
@ -217,6 +240,12 @@ class RpcLiteralRequestMessageBinderTest extends \PHPUnit_Framework_TestCase
array('bar', 'BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\Bar'),
));
$definitionComplexTypes['BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\SimpleArrays'] = $this->createComplexTypeCollection(array(
array('array1', 'string[]', true),
array('array2', 'string[]'),
array('array3', 'string[]'),
));
$definitionComplexTypes['BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\FooRecursive'] = $this->createComplexTypeCollection(array(
array('bar', 'BeSimple\SoapBundle\Tests\fixtures\ServiceBinding\BarRecursive'),
));
@ -246,4 +275,4 @@ class RpcLiteralRequestMessageBinderTest extends \PHPUnit_Framework_TestCase
return $collection;
}
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace BeSimple\SoapBundle\Tests\fixtures\ServiceBinding;
class SimpleArrays
{
public $array1;
private $array2;
private $array3;
public function __construct($array1, $array2, $array3)
{
$this->array1 = $array1;
$this->array2 = $array2;
$this->array3 = $array3;
}
public function getArray2()
{
return $this->array2;
}
public function getArray3()
{
return $this->array3;
}
}