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

Commit

Permalink
Fixed test reporting issue with DocumentLiteral test
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
weierophinney committed Jan 12, 2012
1 parent 22d3660 commit fcc59de
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 21 deletions.
31 changes: 10 additions & 21 deletions test/Server/DocumentLiteralWrapperTest.php
Expand Up @@ -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
{
Expand All @@ -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;
}
}
41 changes: 41 additions & 0 deletions test/TestAsset/MyCalculatorService.php
@@ -0,0 +1,41 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Soap
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

namespace ZendTest\Soap\TestAsset;

/**
* MyCalculatorService
*
* Class used in DocumentLiteralWrapperTest
*/
class MyCalculatorService
{
/**
* @param int $x
* @param int $y
* @return int
*/
public function add($x, $y)
{
return $x+$y;
}
}

0 comments on commit fcc59de

Please sign in to comment.