Ejemplo n.º 1
0
 /**
  * Process array of types.
  *
  * @param string $type
  * @param array $callInfo
  */
 protected function _processArrayParameter($type, $callInfo = array())
 {
     $arrayItemType = $this->_helper->getArrayItemType($type);
     $arrayTypeName = $this->_helper->translateArrayTypeName($type);
     if (!$this->_helper->isTypeSimple($arrayItemType)) {
         $this->addComplexType($arrayItemType, $callInfo);
     }
     $arrayTypeParameters = array(self::ARRAY_ITEM_KEY_NAME => array('type' => $arrayItemType, 'required' => false, 'isArray' => true, 'documentation' => sprintf('An item of %s.', $arrayTypeName)));
     $arrayTypeData = array('documentation' => sprintf('An array of %s items.', $arrayItemType), 'parameters' => $arrayTypeParameters);
     $this->_config->setTypeData($arrayTypeName, $arrayTypeData);
     $this->addComplexType($arrayTypeName, $callInfo);
 }
Ejemplo n.º 2
0
 /**
  * Assert parameter data.
  *
  * @param string $expectedName
  * @param string $expectedType
  * @param string $expectedIsRequired
  * @param string $expectedDoc
  * @param array $expectedAppinfo
  * @param DOMElement $complexType with actual parameter element.
  */
 protected function _assertParameter($expectedName, $expectedType, $expectedIsRequired, $expectedDoc, $expectedAppinfo, DOMElement $complexType)
 {
     $xsdNs = Wsdl::XSD_NS;
     $tns = Wsdl::TYPES_NS;
     /** @var DOMElement $parameterElement */
     $parameterElement = $this->_xpath->query("{$xsdNs}:sequence/{$xsdNs}:element[@name='{$expectedName}']", $complexType)->item(0);
     $this->assertNotNull($parameterElement, sprintf('"%s" element was not found in complex type "%s".', $expectedName, $complexType->getAttribute('name')));
     $isArray = $this->_helper->isArrayType($expectedType);
     if ($isArray) {
         $expectedType = $this->_helper->translateArrayTypeName($expectedType);
     } else {
         $this->assertEquals($expectedIsRequired ? 1 : 0, $parameterElement->getAttribute('minOccurs'));
         $this->assertEquals(1, $parameterElement->getAttribute('maxOccurs'));
     }
     $expectedNs = $this->_helper->isTypeSimple($expectedType) ? $xsdNs : $tns;
     $this->assertEquals("{$expectedNs}:{$expectedType}", $parameterElement->getAttribute('type'));
     $this->_assertDocumentation($expectedDoc, $parameterElement);
     $this->_assertAppinfo($expectedAppinfo, $parameterElement);
 }
Ejemplo n.º 3
0
 /**
  * @dataProvider dataProviderTestTranslateArrayTypeName
  * @param string $typeToBeTranslated
  * @param string $expectedResult
  */
 public function testTranslateArrayTypeName($typeToBeTranslated, $expectedResult)
 {
     $this->assertEquals($expectedResult, $this->_helper->translateArrayTypeName($typeToBeTranslated), "Array type was translated incorrectly.");
 }