From fcc59de74bf10fed271d05681cc7add864a73beb Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Thu, 12 Jan 2012 14:20:11 -0600 Subject: [PATCH] Fixed test reporting issue with DocumentLiteral test - Test needed to run in a separate process... - which exposed issues with TestConfiguration, requiring that we test if a constant is defined prior to defining it. - Also, moved "MyCalculatorService", consumed by DocumentLiteralWrapperTest, to a separate TestAsset file --- test/Server/DocumentLiteralWrapperTest.php | 31 ++++++---------- test/TestAsset/MyCalculatorService.php | 41 ++++++++++++++++++++++ 2 files changed, 51 insertions(+), 21 deletions(-) create mode 100644 test/TestAsset/MyCalculatorService.php diff --git a/test/Server/DocumentLiteralWrapperTest.php b/test/Server/DocumentLiteralWrapperTest.php index a0137689..23a5f6f8 100644 --- a/test/Server/DocumentLiteralWrapperTest.php +++ b/test/Server/DocumentLiteralWrapperTest.php @@ -19,14 +19,13 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ -/** - * @namespace - */ namespace ZendTest\Soap\Server; -use Zend\Soap\Server, +use Zend\Soap\Client\Local as SoapClient, + Zend\Soap\Server, Zend\Soap\ServerException, - Zend\Soap\Server\DocumentLiteralWrapper; + Zend\Soap\Server\DocumentLiteralWrapper, + ZendTest\Soap\TestAsset\MyCalculatorService; class DocumentLiteralWrapperTest extends \PHPUnit_Framework_TestCase { @@ -39,30 +38,20 @@ public function setUp() ini_set("soap.wsdl_cache_enabled", 0); } + /** + * @runInSeparateProcess + */ public function testDelegate() { $server = new Server(__DIR__ . self::WSDL); $server->setObject(new DocumentLiteralWrapper(new MyCalculatorService)); - // The local client needs an abstraction for this pattern aswell, - // this is just a test so we use the messy way. - $client = new \Zend\Soap\Client\Local($server, __DIR__ . self::WSDL); + // The local client needs an abstraction for this pattern as well. + // This is just a test so we use the messy way. + $client = new SoapClient($server, __DIR__ . self::WSDL); $ret = $client->add(array('x' => 10, 'y' => 20)); $this->assertInstanceOf('stdClass', $ret); $this->assertEquals(30, $ret->addResult); } } - -class MyCalculatorService -{ - /** - * @param int $x - * @param int $y - * @return int - */ - public function add($x, $y) - { - return $x+$y; - } -} diff --git a/test/TestAsset/MyCalculatorService.php b/test/TestAsset/MyCalculatorService.php new file mode 100644 index 00000000..853b0109 --- /dev/null +++ b/test/TestAsset/MyCalculatorService.php @@ -0,0 +1,41 @@ +