Beispiel #1
0
 /**
  * @test
  */
 public function shouldParseObjectWithArrayOfWrapper()
 {
     //given
     $parameter = ParameterFactory::createParameterObjectWithArrayOfWrapper();
     //when
     $types = $this->_rpcEncoded->typeParameters($parameter);
     //then
     $type = $types[0];
     $this->assertEquals('ListOfAgents', $type->getName());
     $this->assertEquals(array(array('type' => 'type', 'value' => 'ns:ArrayOfAgents', 'name' => 'agents'), array('type' => 'type', 'value' => 'xsd:int', 'name' => 'id')), $type->getElementAttributes());
     $actualComplex = $type->getComplex();
     Assert::thatArray($actualComplex)->onMethod('getName')->containsExactly('ArrayOfAgents');
     Assert::thatArray($actualComplex)->onMethod('getArrayType')->containsExactly('ns:MocksMockUserWrapper[]');
     $this->assertEquals('MocksMockUserWrapper', $actualComplex[0]->getComplex()->getName());
     $this->assertEquals(array(array('type' => 'type', 'value' => 'xsd:int', 'name' => 'id'), array('type' => 'type', 'value' => 'xsd:string', 'name' => 'name'), array('type' => 'type', 'value' => 'xsd:int', 'name' => 'age')), $actualComplex[0]->getComplex()->getElementAttributes());
 }
 /**
  * @test
  */
 public function shouldParseWhenMultipleWrappers()
 {
     //given
     $parameter = ParameterFactory::createParameterWithMultipleWrappers('method');
     //when
     $types = $this->_documentLiteralWrapped->typeParameters($parameter);
     //then
     $element = $types[0];
     Assert::thatArray($element->getElementAttributes())->containsKeyAndValue(array(array('type' => 'element', 'value' => 'ns:MocksWrapperClassCustomer', 'name' => 'customer'), array('type' => 'element', 'value' => 'ns:MocksWrapperClassPurchase', 'name' => 'purchase')));
     Assert::thatArray($element->getComplex())->onMethod('getName')->containsOnly("MocksWrapperClassCustomer", "MocksWrapperClassPurchase");
 }