Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' of git://git.zendframework.com/zf
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelkael committed Jul 15, 2010
3 parents fa6af0e + 8132ce0 + 03067f1 commit 0b49cb4
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ public function setOptions($options)
$this->setWSDL($value);
break;
case 'featues':
trigger_error(__METHOD__ . ': the option "featues" is deprecated as of 1.10.x and will be removed with 2.0.0; use "features" instead', E_USER_NOTICE);
case 'features':
$this->setSoapFeatures($value);
break;
case 'cache_wsdl':
Expand Down
4 changes: 2 additions & 2 deletions src/WSDL/Strategy/ArrayOfTypeComplex.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ protected function _addArrayOfComplexType($singularType, $type)

$xsdAttribute = $dom->createElement('xsd:attribute');
$xsdAttribute->setAttribute('ref', 'soap-enc:arrayType');
$xsdAttribute->setAttribute('wsdl:arrayType', "tns:{$singularType}[]");
$xsdAttribute->setAttribute('wsdl:arrayType', sprintf('tns:%s[]', $singularType));
$xsdRestriction->appendChild($xsdAttribute);

$this->getContext()->getSchema()->appendChild($complexType);
Expand All @@ -120,7 +120,7 @@ protected function _addArrayOfComplexType($singularType, $type)

protected function _getXsdComplexTypeName($type)
{
return 'ArrayOf' . $type;
return sprintf('ArrayOf%s', $type);
}

/**
Expand Down
34 changes: 34 additions & 0 deletions test/AutoDiscoverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -900,4 +900,38 @@ public function testNoReturnIsOneWayCallInAddFunction()
$wsdl
);
}

/**
* @group ZF-8948
* @group ZF-5766
*/
public function testRecursiveWsdlDependencies()
{
$autodiscover = new Zend_Soap_AutoDiscover('Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex');
$autodiscover->setClass('Zend_Soap_AutoDiscover_Recursion');
$wsdl = $autodiscover->toXml();

// <types>
// <xsd:schema targetNamespace="http://localhost/my_script.php">
// <xsd:complexType name="Zend_Soap_AutoDiscover_Recursion">
// <xsd:all>
// <xsd:element name="recursion" type="tns:Zend_Soap_AutoDiscover_Recursion"/>


$path = '//wsdl:types/xsd:schema/xsd:complexType[@name="Zend_Soap_AutoDiscover_Recursion"]/xsd:all/xsd:element[@name="recursion" and @type="tns:Zend_Soap_AutoDiscover_Recursion"]';
$this->assertWsdlPathExists($wsdl, $path);
}

public function assertWsdlPathExists($xml, $path)
{
$doc = new DOMDocument('UTF-8');
$doc->loadXML($xml);

$xpath = new DOMXPath($doc);
$xpath->registerNamespace('wsdl', 'http://schemas.xmlsoap.org/wsdl/');

$nodes = $xpath->query($path);

$this->assertTrue($nodes->length >= 1, "Could not assert that XML Document contains a node that matches the XPath Expression: " . $path);
}
}
27 changes: 21 additions & 6 deletions test/ServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,22 @@ public function testSetOptionsViaSecondConstructorArgument()
$this->assertTrue($server->getOptions() == $options);
}

public function testSetWSDLViaOptionsArrayIsPossible()
/**
* @group ZF-9816
*/
public function testSetOptionsWithFeaturesOption()
{
$server = new Server(null, array(
'features' => SOAP_SINGLE_ELEMENT_ARRAYS
));

$this->assertEquals(
SOAP_SINGLE_ELEMENT_ARRAYS,
$server->getSoapFeatures()
);
}

public function testSetWsdlViaOptionsArrayIsPossible()
{
$server = new Server();
$server->setOptions(array('wsdl' => 'http://www.example.com/test.wsdl'));
Expand Down Expand Up @@ -243,10 +258,10 @@ public function testSetWSDL()
$server = new Server();

$this->assertNull($server->getWSDL());
$server->setWSDL(dirname(__FILE__).'/_files/wsdl_example.wsdl');
$this->assertEquals(dirname(__FILE__).'/_files/wsdl_example.wsdl', $server->getWSDL());
$server->setWSDL(__DIR__.'/_files/wsdl_example.wsdl');
$this->assertEquals(__DIR__.'/_files/wsdl_example.wsdl', $server->getWSDL());
try {
$server->setWSDL(dirname(__FILE__).'/_files/bogus.wsdl');
$server->setWSDL(__DIR__.'/_files/bogus.wsdl');
$this->fail('Invalid WSDL URI or PATH should fail');
} catch (\Exception $e) {
// success
Expand All @@ -258,8 +273,8 @@ public function testGetWSDL()
$server = new Server();

$this->assertNull($server->getWSDL());
$server->setWSDL(dirname(__FILE__).'/_files/wsdl_example.wsdl');
$this->assertEquals(dirname(__FILE__).'/_files/wsdl_example.wsdl', $server->getWSDL());
$server->setWSDL(__DIR__.'/_files/wsdl_example.wsdl');
$this->assertEquals(__DIR__.'/_files/wsdl_example.wsdl', $server->getWSDL());
}

public function testAddFunction()
Expand Down
5 changes: 5 additions & 0 deletions test/TestAsset/commontypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,11 @@ class ZendTest_Soap_TestAsset_Recursion
* @var ZendTest_Soap_TestAsset_Recursion
*/
public $recursion;

/**
* @return ZendTest_Soap_TestAsset_Recursion
*/
public function create() {}
}

/**
Expand Down
1 change: 1 addition & 0 deletions test/WSDL/ArrayOfTypeComplexStrategyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ public function testArrayOfComplexNestedObjectsIsCoveredByStrategyAndAddsAllType

/**
* @group ZF-5754
* @group ZF-8948
*/
public function testNestingOfSameTypesDoesNotLeadToInfiniteRecursionButWillThrowException()
{
Expand Down

0 comments on commit 0b49cb4

Please sign in to comment.