Permalink
Browse files

[SOAP] Remove Zend\Server\Server interface from Zend\Soap\Autodiscove…

…r. It did never make any sense. Renamed Autodiscover#handle() to Autodiscover#generate()
  • Loading branch information...
beberlei committed Dec 5, 2011
1 parent 6387438 commit c6a1e6baddcf61138f15e28633aa660f2042cc35
Showing with 17 additions and 101 deletions.
  1. +3 −49 library/Zend/Soap/AutoDiscover.php
  2. +14 −52 tests/Zend/Soap/AutoDiscoverTest.php
@@ -35,7 +35,7 @@
* @package Zend_Soap
* @subpackage AutoDiscover
*/
class AutoDiscover implements \Zend\Server\Server
class AutoDiscover
{
/**
* @var \Zend\Soap\Wsdl
@@ -428,23 +428,9 @@ protected function _addFunctionToWsdl($function, $wsdl, $port, $binding)
}
/**
* Action to take when an error occurs
*
* @param string $fault
* @param string|int $code
* @throws \Zend\Soap\Exception\UnexpectedValueException
*/
public function fault($fault = null, $code = null)
{
throw new Exception\UnexpectedValueException('Function has no use in AutoDiscover.');
}
/**
* Handle the Request
*
* @param string $request A non-standard request - Not Used
* Generate the WSDL file from the configured input.
*/
public function handle($request = false)
public function generate()
{
if (!headers_sent()) {
header('Content-Type: text/xml');
@@ -483,38 +469,6 @@ public function toXml()
}
}
/**
* Return an array of functions in the WSDL
*
* @return array
*/
public function getFunctions()
{
return $this->_functions;
}
/**
* Load Functions
*
* @param unknown_type $definition
* @throws \Zend\Soap\Exception\RuntimeException
*/
public function loadFunctions($definition)
{
throw new Exception\RuntimeException('Function has no use in AutoDiscover.');
}
/**
* Set Persistance
*
* @param int $mode
* @throws \Zend\Soap\Exception\RuntimeException
*/
public function setPersistence($mode)
{
throw new Exception\RuntimeException('Function has no use in AutoDiscover.');
}
/**
* Returns an XSD Type for the given PHP type
*
@@ -79,7 +79,7 @@ function testSetClass()
$server->setClass('\ZendTest\Soap\TestAsset\Test');
$dom = new \DOMDocument();
ob_start();
$server->handle();
$server->generate();
$dom->loadXML(ob_get_clean());
$wsdl = '<?xml version="1.0"?>'
@@ -170,7 +170,7 @@ function testSetClassWithDifferentStyles()
$server->setClass('\ZendTest\Soap\TestAsset\Test');
$dom = new \DOMDocument();
ob_start();
$server->handle();
$server->generate();
$dom->loadXML(ob_get_clean());
$wsdl = '<?xml version="1.0"?>'
@@ -328,7 +328,7 @@ function testSetClassWithResponseReturnPartCompabilityMode()
$server->setClass('\ZendTest\Soap\TestAsset\Test');
$dom = new \DOMDocument();
ob_start();
$server->handle();
$server->generate();
$dom->loadXML(ob_get_clean());
$dom->save(__DIR__.'/TestAsset/setclass.wsdl');
@@ -349,7 +349,7 @@ function testAddFunctionSimple()
$server->addFunction('\ZendTest\Soap\TestAsset\TestFunc');
$dom = new \DOMDocument();
ob_start();
$server->handle();
$server->generate();
$dom->loadXML(ob_get_clean());
$dom->save(__DIR__.'/TestAsset/addfunction.wsdl');
@@ -394,7 +394,7 @@ function testAddFunctionSimpleWithDifferentStyle()
$server->addFunction('\ZendTest\Soap\TestAsset\TestFunc');
$dom = new \DOMDocument();
ob_start();
$server->handle();
$server->generate();
$dom->loadXML(ob_get_clean());
$dom->save(__DIR__.'/TestAsset/addfunction.wsdl');
@@ -445,7 +445,7 @@ function testAddFunctionSimpleInReturnNameCompabilityMode()
$server->addFunction('\ZendTest\Soap\TestAsset\TestFunc');
$dom = new \DOMDocument();
ob_start();
$server->handle();
$server->generate();
$dom->loadXML(ob_get_clean());
$dom->save(__DIR__.'/TestAsset/addfunction.wsdl');
@@ -476,7 +476,7 @@ function testAddFunctionMultiple()
$dom = new \DOMDocument();
ob_start();
$server->handle();
$server->generate();
$dom->loadXML(ob_get_clean());
$dom->save(__DIR__.'/TestAsset/addfunction2.wsdl');
@@ -578,7 +578,7 @@ public function testChangeWsdlUriInConstructor()
$server->addFunction('\ZendTest\Soap\TestAsset\TestFunc');
ob_start();
$server->handle();
$server->generate();
$wsdlOutput = ob_get_clean();
$this->assertNotContains($scriptUri, $wsdlOutput);
@@ -597,7 +597,7 @@ public function testChangeWsdlUriViaSetUri()
$server->addFunction('\ZendTest\Soap\TestAsset\TestFunc');
ob_start();
$server->handle();
$server->generate();
$wsdlOutput = ob_get_clean();
$this->assertNotContains($scriptUri, $wsdlOutput);
@@ -624,7 +624,7 @@ public function testChangingWsdlUriAfterGenerationIsPossible()
$server->addFunction('\ZendTest\Soap\TestAsset\TestFunc');
ob_start();
$server->handle();
$server->generate();
$wsdlOutput = ob_get_clean();
$this->assertNotContains($scriptUri, $wsdlOutput);
@@ -633,7 +633,7 @@ public function testChangingWsdlUriAfterGenerationIsPossible()
$server->setUri("http://example2.com/service2.php");
ob_start();
$server->handle();
$server->generate();
$wsdlOutput = ob_get_clean();
$this->assertNotContains($scriptUri, $wsdlOutput);
@@ -654,50 +654,12 @@ public function testUsingClassWithMultipleMethodPrototypesProducesValidWsdl()
$server->setClass('\ZendTest\Soap\TestAsset\TestFixingMultiplePrototypes');
ob_start();
$server->handle();
$server->generate();
$wsdlOutput = ob_get_clean();
$this->assertEquals(1, substr_count($wsdlOutput, '<message name="testFuncIn">'));
$this->assertEquals(1, substr_count($wsdlOutput, '<message name="testFuncOut">'));
}
public function testUnusedFunctionsOfAutoDiscoverThrowExceptionOnBadPersistence()
{
$server = $this->createAutodiscoverService();
$this->setExpectedException('Zend\Soap\Exception\RuntimeException', 'Function has no use in AutoDiscover');
$server->setPersistence("bogus");
}
public function testUnusedFunctionsOfAutoDiscoverThrowExceptionOnFault()
{
$server = $this->createAutodiscoverService();
$this->setExpectedException('Zend\Soap\Exception\UnexpectedValueException', 'Function has no use in AutoDiscover');
$server->fault();
}
public function testUnusedFunctionsOfAutoDiscoverThrowExceptionOnLoadFunctionsCall()
{
$server = $this->createAutodiscoverService();
$this->setExpectedException('Zend\Soap\Exception\RuntimeException', 'Function has no use in AutoDiscover');
$server->loadFunctions("bogus");
}
public function testGetFunctions()
{
$server = $this->createAutodiscoverService();
$server->addFunction('\ZendTest\Soap\TestAsset\TestFunc');
$server->setClass('\ZendTest\Soap\TestAsset\Test');
$functions = $server->getFunctions();
$this->assertEquals(
array('ZendTest\Soap\TestAsset\TestFunc', 'testFunc1', 'testFunc2', 'testFunc3', 'testFunc4'),
$functions
);
}
/**
* @group ZF-4937
@@ -709,7 +671,7 @@ public function testComplexTypesThatAreUsedMultipleTimesAreRecoginzedOnce()
$server->setClass('\ZendTest\Soap\TestAsset\AutoDiscoverTestClass2');
ob_start();
$server->handle();
$server->generate();
$wsdlOutput = ob_get_clean();
$this->assertEquals(1,
@@ -739,7 +701,7 @@ public function testDumpOrXmlOfAutoDiscover()
$server->addFunction('\ZendTest\Soap\TestAsset\TestFunc');
ob_start();
$server->handle();
$server->generate();
$wsdlOutput = ob_get_clean();
$this->assertEquals(

2 comments on commit c6a1e6b

@jducro

This comment has been minimized.

Show comment
Hide comment
@jducro

jducro Dec 15, 2011

Is it possible to update the documentation : http://framework.zend.com/manual/en/zend.soap.autodiscovery.html ?
The handle function don't exists anymore

jducro replied Dec 15, 2011

Is it possible to update the documentation : http://framework.zend.com/manual/en/zend.soap.autodiscovery.html ?
The handle function don't exists anymore

@beberlei

This comment has been minimized.

Show comment
Hide comment
@beberlei

beberlei Dec 15, 2011

Contributor

This is a stable version doc. The docs for this have been updated

Contributor

beberlei replied Dec 15, 2011

This is a stable version doc. The docs for this have been updated

Please sign in to comment.