From 56f26193cbc9f62b62d1301f901269dc8ced30e1 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Thu, 21 Apr 2016 10:54:40 -0500 Subject: [PATCH 1/3] Updated dependencies - PHP: `^5.5 || ^7.0` - zend-stdlib: `^2.7 || ^3.0` - all other ZF components updated to known stable, forwards-compatible versions - PHPUnit: `^4.8` - swapped out php-cs-fixer for phpcs - Added composer scripts, and updated composer.json to use them - Fixed all CS issues --- .coveralls.yml | 1 - .php_cs | 45 ----- .travis.yml | 18 +- composer.json | 33 ++- phpcs.xml | 23 +++ src/AutoDiscover.php | 31 +-- src/Client.php | 46 ++++- src/Client/Common.php | 4 - src/Client/DotNet.php | 36 +++- src/Client/Local.php | 2 + src/Server.php | 8 +- src/Server/DocumentLiteralWrapper.php | 42 ++-- src/Wsdl.php | 102 ++++++---- .../ArrayOfTypeComplex.php | 12 +- .../ArrayOfTypeSequence.php | 23 ++- test/AutoDiscover/OnlineTest.php | 19 +- test/AutoDiscoverTest.php | 190 +++++++++++------- test/Client/DotNetTest.php | 101 ++++++---- test/ClientTest.php | 115 +++++++---- test/ServerTest.php | 77 ++++--- test/TestAsset/MockCallUserFunc.php | 2 +- test/TestAsset/call_user_func.php | 3 +- test/TestAsset/commontypes.php | 98 ++++----- test/TestAsset/fulltests/server1.php | 4 +- test/Wsdl/ArrayOfTypeComplexStrategyTest.php | 126 ++++++++---- test/Wsdl/ArrayOfTypeSequenceStrategyTest.php | 94 ++++++--- test/Wsdl/CompositeStrategyTest.php | 20 +- test/Wsdl/DefaultComplexTypeTest.php | 2 - test/WsdlTest.php | 134 +++++++----- test/WsdlTestHelper.php | 16 +- test/_files/commontypes.php | 20 +- test/_files/fulltests/server1.php | 4 +- 32 files changed, 885 insertions(+), 566 deletions(-) delete mode 100644 .php_cs create mode 100644 phpcs.xml diff --git a/.coveralls.yml b/.coveralls.yml index 53bda829..bc71b62f 100644 --- a/.coveralls.yml +++ b/.coveralls.yml @@ -1,3 +1,2 @@ coverage_clover: clover.xml json_path: coveralls-upload.json -src_dir: src diff --git a/.php_cs b/.php_cs deleted file mode 100644 index 8f4dd5aa..00000000 --- a/.php_cs +++ /dev/null @@ -1,45 +0,0 @@ -in('src') - ->in('test') - ->notPath('TestAsset') - ->notPath('_files') - ->filter(function (SplFileInfo $file) { - if (strstr($file->getPath(), 'compatibility')) { - return false; - } - }); -$config = Symfony\CS\Config\Config::create(); -$config->level(null); -$config->fixers( - array( - 'braces', - 'duplicate_semicolon', - 'elseif', - 'empty_return', - 'encoding', - 'eof_ending', - 'function_call_space', - 'function_declaration', - 'indentation', - 'join_function', - 'line_after_namespace', - 'linefeed', - 'lowercase_keywords', - 'parenthesis', - 'multiple_use', - 'method_argument_space', - 'object_operator', - 'php_closing_tag', - 'remove_lines_between_uses', - 'short_array_syntax', - 'short_tag', - 'standardize_not_equal', - 'trailing_spaces', - 'unused_use', - 'visibility', - 'whitespacy_lines', - ) -); -$config->finder($finder); -return $config; diff --git a/.travis.yml b/.travis.yml index ff1696cf..5bb503e2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,10 +26,10 @@ matrix: include: - php: 5.5 env: - - EXECUTE_CS_CHECK=true + - CS_CHECK=true - php: 5.6 env: - - EXECUTE_TEST_COVERALLS=true + - TEST_COVERAGE=true - DEPLOY_DOCS="$(if [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' ]]; then echo -n 'true' ; else echo -n 'false' ; fi)" - PATH="$HOME/.local/bin:$PATH" - php: 7 @@ -43,21 +43,21 @@ notifications: email: false before_install: - - if [[ $EXECUTE_TEST_COVERALLS != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi - - composer self-update - - if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then composer require --dev --no-update satooshi/php-coveralls ; fi + - if [[ $TEST_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi + - travis_retry composer self-update install: + - if [[ $TEST_COVERAGE == 'true' ]]; then composer require --dev --no-update satooshi/php-coveralls ; fi - travis_retry composer install --no-interaction --ignore-platform-reqs script: - - if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then ./vendor/bin/phpunit --coverage-clover clover.xml ; fi - - if [[ $EXECUTE_TEST_COVERALLS != 'true' ]]; then ./vendor/bin/phpunit ; fi - - if [[ $EXECUTE_CS_CHECK == 'true' ]]; then ./vendor/bin/php-cs-fixer fix -v --diff --dry-run ; fi + - if [[ $TEST_COVERAGE == 'true' ]]; then composer test-coverage ; fi + - if [[ $TEST_COVERAGE != 'true' ]]; then composer test; fi + - if [[ $CS_CHECK == 'true' ]]; then composer cs-check ; fi - if [[ $DEPLOY_DOCS == "true" && "$TRAVIS_TEST_RESULT" == "0" ]]; then wget -O theme-installer.sh "https://raw.githubusercontent.com/zendframework/zf-mkdoc-theme/master/theme-installer.sh" ; chmod 755 theme-installer.sh ; ./theme-installer.sh ; fi after_success: - if [[ $DEPLOY_DOCS == "true" ]]; then echo "Preparing to build and deploy documentation" ; ./zf-mkdoc-theme/deploy.sh ; echo "Completed deploying documentation" ; fi after_script: - - if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then ./vendor/bin/coveralls ; fi + - if [[ $TEST_COVERAGE == 'true' ]]; then travis_retry composer upload-coverage ; fi diff --git a/composer.json b/composer.json index ece07477..8665abb5 100644 --- a/composer.json +++ b/composer.json @@ -13,16 +13,16 @@ } }, "require": { - "php": ">=5.5", - "zendframework/zend-server": "~2.5", - "zendframework/zend-stdlib": "~2.5", - "zendframework/zend-uri": "~2.5" + "php": "^5.5 || ^7.0", + "zendframework/zend-server": "^2.6.1", + "zendframework/zend-stdlib": "^2.7 || ^3.0", + "zendframework/zend-uri": "^2.5.2" }, "require-dev": { - "zendframework/zend-config": "~2.5", - "zendframework/zend-http": "~2.5", - "fabpot/php-cs-fixer": "1.7.*", - "phpunit/PHPUnit": "~4.0" + "zendframework/zend-config": "^2.6", + "zendframework/zend-http": "^2.5.4", + "phpunit/PHPUnit": "^4.8", + "squizlabs/php_codesniffer": "^2.3.1" }, "suggest": { "zendframework/zend-http": "Zend\\Http component" @@ -38,6 +38,21 @@ "autoload-dev": { "psr-4": { "ZendTest\\Soap\\": "test/" - } + }, + "files": [ + "test/TestAsset/commontypes.php", + "test/TestAsset/call_user_func.php" + ] + }, + "scripts": { + "check": [ + "@cs-check", + "@test" + ], + "upload-coverage": "coveralls -v", + "cs-check": "phpcs", + "cs-fix": "phpcbf", + "test": "phpunit", + "test-coverage": "phpunit --coverage-clover clover.xml" } } diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 00000000..3a753816 --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,23 @@ + + + Zend Framework coding standard + + + + + + + + + + + + + + + + src + test + test/_files/* + test/TestAsset/* + diff --git a/src/AutoDiscover.php b/src/AutoDiscover.php index 3b6d96b2..5dc3fc54 100644 --- a/src/AutoDiscover.php +++ b/src/AutoDiscover.php @@ -377,9 +377,9 @@ public function addFunction($function) * * @return Wsdl */ - protected function _generateClass() + protected function generateClass() { - return $this->_generateWsdl($this->reflection->reflectClass($this->class)->getMethods()); + return $this->generateWsdl($this->reflection->reflectClass($this->class)->getMethods()); } /** @@ -387,13 +387,13 @@ protected function _generateClass() * * @return Wsdl */ - protected function _generateFunctions() + protected function generateFunctions() { $methods = []; foreach (array_unique($this->functions) as $func) { $methods[] = $this->reflection->reflectFunction($func); } - return $this->_generateWsdl($methods); + return $this->generateWsdl($methods); } /** @@ -402,7 +402,7 @@ protected function _generateFunctions() * @param array $reflectionMethods * @return Wsdl */ - protected function _generateWsdl(array $reflectionMethods) + protected function generateWsdl(array $reflectionMethods) { $uri = $this->getUri(); @@ -417,10 +417,15 @@ protected function _generateWsdl(array $reflectionMethods) $binding = $wsdl->addBinding($serviceName . 'Binding', Wsdl::TYPES_NS . ':' . $serviceName . 'Port'); $wsdl->addSoapBinding($binding, $this->bindingStyle['style'], $this->bindingStyle['transport']); - $wsdl->addService($serviceName . 'Service', $serviceName . 'Port', Wsdl::TYPES_NS . ':' . $serviceName . 'Binding', $uri); + $wsdl->addService( + $serviceName . 'Service', + $serviceName . 'Port', + Wsdl::TYPES_NS . ':' . $serviceName . 'Binding', + $uri + ); foreach ($reflectionMethods as $method) { - $this->_addFunctionToWsdl($method, $wsdl, $port, $binding); + $this->addFunctionToWsdl($method, $wsdl, $port, $binding); } return $wsdl; @@ -435,7 +440,7 @@ protected function _generateWsdl(array $reflectionMethods) * @param $binding \DOMElement wsdl:binding * @throws Exception\InvalidArgumentException */ - protected function _addFunctionToWsdl($function, $wsdl, $port, $binding) + protected function addFunctionToWsdl($function, $wsdl, $port, $binding) { $uri = $this->getUri(); @@ -528,13 +533,15 @@ protected function _addFunctionToWsdl($function, $wsdl, $port, $binding) $portOperation = $wsdl->addPortOperation( $port, $functionName, - Wsdl::TYPES_NS . ':' . $functionName . 'In', Wsdl::TYPES_NS . ':' . $functionName . 'Out' + Wsdl::TYPES_NS . ':' . $functionName . 'In', + Wsdl::TYPES_NS . ':' . $functionName . 'Out' ); } else { $portOperation = $wsdl->addPortOperation( $port, $functionName, - Wsdl::TYPES_NS . ':' . $functionName . 'In', false + Wsdl::TYPES_NS . ':' . $functionName . 'In', + false ); } $desc = $this->discoveryStrategy->getFunctionDocumentation($function); @@ -572,9 +579,9 @@ public function generate() } if ($this->class) { - $wsdl = $this->_generateClass(); + $wsdl = $this->generateClass(); } else { - $wsdl = $this->_generateFunctions(); + $wsdl = $this->generateFunctions(); } return $wsdl; diff --git a/src/Client.php b/src/Client.php index f28e3860..99bd4e92 100644 --- a/src/Client.php +++ b/src/Client.php @@ -405,15 +405,21 @@ public function getClassmap() public function setTypemap(array $typeMap) { foreach ($typeMap as $type) { - if (!is_callable($type['from_xml'])) { - throw new Exception\InvalidArgumentException('Invalid from_xml callback for type: ' . $type['type_name']); + if (! is_callable($type['from_xml'])) { + throw new Exception\InvalidArgumentException(sprintf( + 'Invalid from_xml callback for type: %s', + $type['type_name'] + )); } - if (!is_callable($type['to_xml'])) { - throw new Exception\InvalidArgumentException('Invalid to_xml callback for type: ' . $type['type_name']); + if (! is_callable($type['to_xml'])) { + throw new Exception\InvalidArgumentException(sprintf( + 'Invalid to_xml callback for type: %s', + $type['type_name'] + )); } } - $this->typemap = $typeMap; + $this->typemap = $typeMap; $this->soapClient = null; return $this; } @@ -971,6 +977,7 @@ public function getLastMethod() return $this->lastMethod; } + // @codingStandardsIgnoreStart /** * Do request proxy method. * @@ -988,17 +995,31 @@ public function _doRequest(Client\Common $client, $request, $location, $action, { // Perform request as is if ($oneWay === null) { - return call_user_func([$client, 'SoapClient::__doRequest'], $request, $location, $action, $version); + return call_user_func( + [$client, 'SoapClient::__doRequest'], + $request, + $location, + $action, + $version + ); } - return call_user_func([$client, 'SoapClient::__doRequest'], $request, $location, $action, $version, $oneWay); + return call_user_func( + [$client, 'SoapClient::__doRequest'], + $request, + $location, + $action, + $version, + $oneWay + ); } + // @codingStandardsIgnoreEnd /** * Initialize SOAP Client object * * @throws Exception\ExceptionInterface */ - protected function _initSoapClientObject() + protected function initSoapClientObject() { $wsdl = $this->getWSDL(); $options = array_merge($this->getOptions(), ['trace' => true]); @@ -1023,7 +1044,7 @@ protected function _initSoapClientObject() $this->soapClient = new Client\Common([$this, '_doRequest'], $wsdl, $options); } - + // @codingStandardsIgnoreStart /** * Perform arguments pre-processing * @@ -1037,7 +1058,9 @@ protected function _preProcessArguments($arguments) // Do nothing return $arguments; } + // @codingStandardsIgnoreEnd + // @codingStandardsIgnoreStart /** * Perform result pre-processing * @@ -1051,6 +1074,7 @@ protected function _preProcessResult($result) // Do nothing return $result; } + // @codingStandardsIgnoreEnd /** * Add SOAP input header @@ -1192,7 +1216,7 @@ public function setSoapClient(SoapClient $soapClient) public function getSoapClient() { if ($this->soapClient === null) { - $this->_initSoapClientObject(); + $this->initSoapClientObject(); } return $this->soapClient; } @@ -1204,7 +1228,7 @@ public function getSoapClient() * @param string $cookieValue * @return self */ - public function setCookie($cookieName, $cookieValue=null) + public function setCookie($cookieName, $cookieValue = null) { $soapClient = $this->getSoapClient(); $soapClient->__setCookie($cookieName, $cookieValue); diff --git a/src/Client/Common.php b/src/Client/Common.php index 5b1c2fb4..0cf1b675 100644 --- a/src/Client/Common.php +++ b/src/Client/Common.php @@ -11,10 +11,6 @@ use SoapClient; -if (! extension_loaded('soap')) { - return; -} - class Common extends SoapClient { /** diff --git a/src/Client/DotNet.php b/src/Client/DotNet.php index abcce5c9..eca71963 100644 --- a/src/Client/DotNet.php +++ b/src/Client/DotNet.php @@ -67,6 +67,7 @@ public function __construct($wsdl = null, $options = null) parent::__construct($wsdl, $options); } + // @codingStandardsIgnoreStart /** * Do request proxy method. * @@ -80,8 +81,15 @@ public function __construct($wsdl = null, $options = null) */ public function _doRequest(CommonClient $client, $request, $location, $action, $version, $oneWay = null) { - if (!$this->useNtlm) { - return parent::_doRequest($client, $request, $location, $action, $version, $oneWay); + if (! $this->useNtlm) { + return parent::_doRequest( + $client, + $request, + $location, + $action, + $version, + $oneWay + ); } $curlClient = $this->getCurlClient(); @@ -96,10 +104,15 @@ public function _doRequest(CommonClient $client, $request, $location, $action, $ $uri = new HttpUri($location); // @todo use parent set* options for ssl certificate authorization - $curlClient->setCurlOption(CURLOPT_HTTPAUTH, CURLAUTH_NTLM) - ->setCurlOption(CURLOPT_SSL_VERIFYHOST, false) - ->setCurlOption(CURLOPT_SSL_VERIFYPEER, false) - ->setCurlOption(CURLOPT_USERPWD, $this->options['login'] . ':' . $this->options['password']); + $curlClient + ->setCurlOption(CURLOPT_HTTPAUTH, CURLAUTH_NTLM) + ->setCurlOption(CURLOPT_SSL_VERIFYHOST, false) + ->setCurlOption(CURLOPT_SSL_VERIFYPEER, false) + ->setCurlOption(CURLOPT_USERPWD, sprintf( + '%s:%s', + $this->options['login'], + $this->options['password'] + )); // Perform the cURL request and get the response $curlClient->connect($uri->getHost(), $uri->getPort()); @@ -116,6 +129,7 @@ public function _doRequest(CommonClient $client, $request, $location, $action, $ // Return only the XML body return $response->getBody(); } + // @codingStandardsIgnoreEnd /** * Returns the cURL client that is being used. @@ -182,6 +196,7 @@ public function setOptions($options) return parent::setOptions($options); } + // @codingStandardsIgnoreStart /** * Perform arguments pre-processing * @@ -193,18 +208,20 @@ public function setOptions($options) */ protected function _preProcessArguments($arguments) { - if (count($arguments) > 1 || - (count($arguments) == 1 && !is_array(reset($arguments))) + if (count($arguments) > 1 + || (count($arguments) == 1 && ! is_array(reset($arguments))) ) { throw new Exception\RuntimeException( - '.Net webservice arguments have to be grouped into array: array("a" => $a, "b" => $b, ...).' + '.Net webservice arguments must be grouped into an array: array("a" => $a, "b" => $b, ...).' ); } // Do nothing return $arguments; } + // @codingStandardsIgnoreEnd + // @codingStandardsIgnoreStart /** * Perform result pre-processing * @@ -221,6 +238,7 @@ protected function _preProcessResult($result) } return $result; } + // @codingStandardsIgnoreEnd /** * Flattens an HTTP headers array into a string. diff --git a/src/Client/Local.php b/src/Client/Local.php index fc9868c0..bb262ff6 100644 --- a/src/Client/Local.php +++ b/src/Client/Local.php @@ -43,6 +43,7 @@ public function __construct(SOAPServer $server, $wsdl, $options = null) parent::__construct($wsdl, $options); } + // @codingStandardsIgnoreStart /** * Actual "do request" method. * @@ -70,4 +71,5 @@ public function _doRequest(Common $client, $request, $location, $action, $versio return $response; } + // @codingStandardsIgnoreEnd } diff --git a/src/Server.php b/src/Server.php index 6228d7a9..a6e9fc43 100644 --- a/src/Server.php +++ b/src/Server.php @@ -726,7 +726,7 @@ public function getPersistence() * @return self * @throws Exception\InvalidArgumentException */ - protected function _setRequest($request) + protected function setRequest($request) { $xml = null; @@ -894,11 +894,11 @@ public function handle($request = null) } // Set Server error handler - $displayErrorsOriginalState = $this->_initializeSoapErrorContext(); + $displayErrorsOriginalState = $this->initializeSoapErrorContext(); $setRequestException = null; try { - $this->_setRequest($request); + $this->setRequest($request); } catch (\Exception $e) { $setRequestException = $e; } @@ -953,7 +953,7 @@ public function handle($request = null) * * @return bool display_errors original value */ - protected function _initializeSoapErrorContext() + protected function initializeSoapErrorContext() { $displayErrorsOriginalState = ini_get('display_errors'); ini_set('display_errors', '0'); diff --git a/src/Server/DocumentLiteralWrapper.php b/src/Server/DocumentLiteralWrapper.php index 7d2873bb..7161b011 100644 --- a/src/Server/DocumentLiteralWrapper.php +++ b/src/Server/DocumentLiteralWrapper.php @@ -23,15 +23,19 @@ * * Example: * - * class MyCalculatorService - * { - * /** - * * @param int $x - * * @param int $y - * * @return int - * * - * public function add($x, $y) {} - * } + * + * class MyCalculatorService + * { + * /** + * * @param int $x + * * @param int $y + * * @return int + * * + * public function add($x, $y) + * { + * } + * } + * * * The document/literal wrapper pattern would lead php ext/soap to generate a * single "request" object that contains $x and $y properties. To solve this a @@ -42,9 +46,11 @@ * MyCalculatorServiceClient#add(10, 20) would lead PHP ext/soap to create * the following request object: * + * * $addRequest = new \stdClass; * $addRequest->x = 10; * $addRequest->y = 20; + * * * This object does not match the signature of the server-side * MyCalculatorService and lead to failure. @@ -52,8 +58,10 @@ * Also the response object in this case is supposed to be an array * or object with a property "addResult": * + * * $addResponse = new \stdClass; * $addResponse->addResult = 30; + * * * To keep your service object code free from this implementation detail * of SOAP this wrapper service handles the parsing between the formats. @@ -98,12 +106,12 @@ public function __construct($object) */ public function __call($method, $args) { - $this->_assertOnlyOneArgument($args); - $this->_assertServiceDelegateHasMethod($method); + $this->assertOnlyOneArgument($args); + $this->assertServiceDelegateHasMethod($method); - $delegateArgs = $this->_parseArguments($method, $args[0]); + $delegateArgs = $this->parseArguments($method, $args[0]); $ret = call_user_func_array([$this->object, $method], $delegateArgs); - return $this->_getResultMessage($method, $ret); + return $this->getResultMessage($method, $ret); } /** @@ -115,7 +123,7 @@ public function __call($method, $args) * @return array * @throws Exception\UnexpectedValueException */ - protected function _parseArguments($method, $document) + protected function parseArguments($method, $document) { $reflMethod = $this->reflection->getMethod($method); $params = []; @@ -146,7 +154,7 @@ protected function _parseArguments($method, $document) * @param mixed $ret * @return array */ - protected function _getResultMessage($method, $ret) + protected function getResultMessage($method, $ret) { return [$method . 'Result' => $ret]; } @@ -155,7 +163,7 @@ protected function _getResultMessage($method, $ret) * @param string $method * @throws Exception\BadMethodCallException */ - protected function _assertServiceDelegateHasMethod($method) + protected function assertServiceDelegateHasMethod($method) { if (!$this->reflection->hasMethod($method)) { throw new Exception\BadMethodCallException(sprintf( @@ -170,7 +178,7 @@ protected function _assertServiceDelegateHasMethod($method) * @param array $args * @throws Exception\UnexpectedValueException */ - protected function _assertOnlyOneArgument(array $args) + protected function assertOnlyOneArgument(array $args) { if (count($args) != 1) { throw new Exception\UnexpectedValueException(sprintf( diff --git a/src/Wsdl.php b/src/Wsdl.php index 68ab64fe..5d716813 100644 --- a/src/Wsdl.php +++ b/src/Wsdl.php @@ -125,15 +125,15 @@ protected function getDOMDocument($name, $uri = null) $dom->appendChild($definitions); $uri = $this->sanitizeUri($uri); - $this->setAttributeWithSanitization($definitions, 'name', $name); - $this->setAttributeWithSanitization($definitions, 'targetNamespace', $uri); + $this->setAttributeWithSanitization($definitions, 'name', $name); + $this->setAttributeWithSanitization($definitions, 'targetNamespace', $uri); - $definitions->setAttributeNS(self::XML_NS_URI, 'xmlns:'. self::WSDL_NS, self::WSDL_NS_URI); - $definitions->setAttributeNS(self::XML_NS_URI, 'xmlns:'. self::TYPES_NS, $uri); - $definitions->setAttributeNS(self::XML_NS_URI, 'xmlns:'. self::SOAP_11_NS, self::SOAP_11_NS_URI); - $definitions->setAttributeNS(self::XML_NS_URI, 'xmlns:'. self::XSD_NS, self::XSD_NS_URI); - $definitions->setAttributeNS(self::XML_NS_URI, 'xmlns:'. self::SOAP_ENC_NS, self::SOAP_ENC_URI); - $definitions->setAttributeNS(self::XML_NS_URI, 'xmlns:'. self::SOAP_12_NS, self::SOAP_12_NS_URI); + $definitions->setAttributeNS(self::XML_NS_URI, 'xmlns:'. self::WSDL_NS, self::WSDL_NS_URI); + $definitions->setAttributeNS(self::XML_NS_URI, 'xmlns:'. self::TYPES_NS, $uri); + $definitions->setAttributeNS(self::XML_NS_URI, 'xmlns:'. self::SOAP_11_NS, self::SOAP_11_NS_URI); + $definitions->setAttributeNS(self::XML_NS_URI, 'xmlns:'. self::XSD_NS, self::XSD_NS_URI); + $definitions->setAttributeNS(self::XML_NS_URI, 'xmlns:'. self::SOAP_ENC_NS, self::SOAP_ENC_URI); + $definitions->setAttributeNS(self::XML_NS_URI, 'xmlns:'. self::SOAP_12_NS, self::SOAP_12_NS_URI); return $dom; } @@ -197,14 +197,14 @@ public function setUri($uri) $this->dom->documentElement->setAttributeNS(self::XML_NS_URI, self::XML_NS . ':' . self::TYPES_NS, $uri); $xpath = new DOMXPath($this->dom); - $xpath->registerNamespace('default', self::WSDL_NS_URI); + $xpath->registerNamespace('default', self::WSDL_NS_URI); - $xpath->registerNamespace(self::TYPES_NS, $uri); - $xpath->registerNamespace(self::SOAP_11_NS, self::SOAP_11_NS_URI); - $xpath->registerNamespace(self::SOAP_12_NS, self::SOAP_12_NS_URI); - $xpath->registerNamespace(self::XSD_NS, self::XSD_NS_URI); - $xpath->registerNamespace(self::SOAP_ENC_NS, self::SOAP_ENC_URI); - $xpath->registerNamespace(self::WSDL_NS, self::WSDL_NS_URI); + $xpath->registerNamespace(self::TYPES_NS, $uri); + $xpath->registerNamespace(self::SOAP_11_NS, self::SOAP_11_NS_URI); + $xpath->registerNamespace(self::SOAP_12_NS, self::SOAP_12_NS_URI); + $xpath->registerNamespace(self::XSD_NS, self::XSD_NS_URI); + $xpath->registerNamespace(self::SOAP_ENC_NS, self::SOAP_ENC_URI); + $xpath->registerNamespace(self::WSDL_NS, self::WSDL_NS_URI); // Select only attribute nodes. Data nodes does not contain uri // except for documentation node but this is for the user to decide. @@ -314,7 +314,8 @@ public function addMessage($messageName, $parts) * Add a {@link http://www.w3.org/TR/wsdl#_porttypes portType} element to the WSDL * * @param string $name portType element's name - * @return DOMElement The new portType's XML_Tree_Node for use in {@link function addPortOperation} and addDocumentation@link function addDocumentation} + * @return DOMElement The new portType's XML_Tree_Node for use in + * {@link addPortOperation} and {@link addDocumentation} */ public function addPortType($name) { @@ -367,7 +368,8 @@ public function addPortOperation($portType, $name, $input = false, $output = fal * * @param string $name Name of the Binding * @param string $portType name of the portType to bind - * @return DOMElement The new binding's XML_Tree_Node for use with {@link function addBindingOperation} and {@link function addDocumentation} + * @return DOMElement The new binding's XML_Tree_Node for use with + * {@link function addBindingOperation} and {@link function addDocumentation} */ public function addBinding($name, $portType) { @@ -383,22 +385,30 @@ public function addBinding($name, $portType) /** * Add an operation to a binding element * - * @param DOMElement $binding A binding XML_Tree_Node returned by {@link function addBinding} + * @param DOMElement $binding A binding XML_Tree_Node returned by + * {@link function addBinding} * @param string $name * @param array|bool $input An array of attributes for the input element, - * allowed keys are: 'use', 'namespace', 'encodingStyle'. - * {@link http://www.w3.org/TR/wsdl#_soap:body More Information} + * allowed keys are: 'use', 'namespace', 'encodingStyle'. + * {@link http://www.w3.org/TR/wsdl#_soap:body More Information} * @param array|bool $output An array of attributes for the output element, - * allowed keys are: 'use', 'namespace', 'encodingStyle'. - * {@link http://www.w3.org/TR/wsdl#_soap:body More Information} + * allowed keys are: 'use', 'namespace', 'encodingStyle'. + * {@link http://www.w3.org/TR/wsdl#_soap:body More Information} * @param array|bool $fault An array with attributes for the fault element, - * allowed keys are: 'name', 'use', 'namespace', 'encodingStyle'. - * {@link http://www.w3.org/TR/wsdl#_soap:body More Information} + * allowed keys are: 'name', 'use', 'namespace', 'encodingStyle'. + * {@link http://www.w3.org/TR/wsdl#_soap:body More Information} * @param int $soapVersion SOAP version: SOAP_1_1 or SOAP_1_2, default: SOAP_1_1 - * @return DOMElement The new Operation's XML_Tree_Node for use with {@link function addSoapOperation} and {@link function addDocumentation} + * @return DOMElement The new Operation's XML_Tree_Node for use with {@link + * function addSoapOperation} and {@link function addDocumentation} */ - public function addBindingOperation($binding, $name, $input = false, $output = false, $fault = false, $soapVersion = SOAP_1_1) - { + public function addBindingOperation( + $binding, + $name, + $input = false, + $output = false, + $fault = false, + $soapVersion = SOAP_1_1 + ) { $operation = $this->dom->createElementNS(self::WSDL_NS_URI, 'operation'); $binding->appendChild($operation); @@ -443,8 +453,12 @@ public function addBindingOperation($binding, $name, $input = false, $output = f * @param int $soapVersion SOAP version: SOAP_1_1 or SOAP_1_2, default: SOAP_1_1 * @return DOMElement */ - public function addSoapBinding($binding, $style = 'document', $transport = 'http://schemas.xmlsoap.org/soap/http', $soapVersion = SOAP_1_1) - { + public function addSoapBinding( + $binding, + $style = 'document', + $transport = 'http://schemas.xmlsoap.org/soap/http', + $soapVersion = SOAP_1_1 + ) { $soapBinding = $this->dom->createElementNS($this->getSoapNamespaceUriByVersion($soapVersion), 'binding'); $binding->appendChild($soapBinding); @@ -512,11 +526,17 @@ public function addService($name, $portName, $binding, $location, $soapVersion = /** * Add a documentation element to any element in the WSDL. * - * Note that the WSDL {@link http://www.w3.org/TR/wsdl#_documentation specification} uses 'document', - * but the WSDL {@link http://schemas.xmlsoap.org/wsdl/ schema} uses 'documentation' instead. - * The {@link http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html#WSDL_documentation_Element WS-I Basic Profile 1.1} recommends using 'documentation'. + * Note that the WSDL specification uses 'document', but the WSDL schema + * uses 'documentation' instead. + * + * The WS-I Basic Profile 1.1 recommends using 'documentation'. * - * @param DOMElement $inputNode An XML_Tree_Node returned by another method to add the documentation to + * @see http://www.w3.org/TR/wsdl#_documentation WSDL specification + * @see http://schemas.xmlsoap.org/wsdl/ WSDL schema + * @see http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html#WSDL_documentation_Element WS-I Basic + * Profile 1.1 + * @param DOMElement $inputNode An XML_Tree_Node returned by another + * method to add the documentation to * @param string $documentation Human readable documentation for the node * @return DOMElement The documentation element */ @@ -543,7 +563,9 @@ public function addDocumentation($inputNode, $documentation) /** * Add WSDL Types element * - * @param DOMDocument|DOMNode|DOMElement|DOMDocumentFragment $types A DOMDocument|DOMNode|DOMElement|DOMDocumentFragment with all the XML Schema types defined in it + * @param DOMDocument|DOMNode|DOMElement|DOMDocumentFragment $types A + * DOMDocument|DOMNode|DOMElement|DOMDocumentFragment with all the XML + * Schema types defined in it */ public function addTypes(DOMNode $types) { @@ -679,7 +701,7 @@ public function getType($type) default: // delegate retrieval of complex type to current strategy return $this->addComplexType($type); - } + } } /** @@ -752,7 +774,7 @@ public function addComplexType($type) * @return DOMElement parsed element * @throws Exception\RuntimeException if $element is not an array */ - protected function _parseElement($element) + protected function parseElement($element) { if (!is_array($element)) { throw new Exception\RuntimeException('The "element" parameter needs to be an associative array.'); @@ -766,7 +788,7 @@ protected function _parseElement($element) if (count($value) > 0) { $container = $this->dom->createElementNS(self::XSD_NS_URI, $key); foreach ($value as $subElement) { - $subElementXML = $this->_parseElement($subElement); + $subElementXML = $this->parseElement($subElement); $container->appendChild($subElementXML); } $complexType->appendChild($container); @@ -803,7 +825,9 @@ protected function sanitizeAttributeValueByName($name, $value) } /** - * Convert associative array to attributes of given node using optional {@link function sanitizeAttributeValueByName} + * Convert associative array to attributes of given node + * + * Optionally uses {@link function sanitizeAttributeValueByName}. * * @param DOMNode $node * @param array $attributes @@ -890,7 +914,7 @@ protected function getSoapNamespaceUriByVersion($soapVersion) public function addElement($element) { $schema = $this->getSchema(); - $elementXml = $this->_parseElement($element); + $elementXml = $this->parseElement($element); $schema->appendChild($elementXml); return self::TYPES_NS . ':' . $element['name']; diff --git a/src/Wsdl/ComplexTypeStrategy/ArrayOfTypeComplex.php b/src/Wsdl/ComplexTypeStrategy/ArrayOfTypeComplex.php index 16f9eee5..6c2296ea 100644 --- a/src/Wsdl/ComplexTypeStrategy/ArrayOfTypeComplex.php +++ b/src/Wsdl/ComplexTypeStrategy/ArrayOfTypeComplex.php @@ -28,8 +28,8 @@ public function addComplexType($type) return $soapType; } - $singularType = $this->_getSingularPhpType($type); - $nestingLevel = $this->_getNestedCount($type); + $singularType = $this->getSingularPhpType($type); + $nestingLevel = $this->getNestedCount($type); if ($nestingLevel == 0) { return parent::addComplexType($singularType); @@ -43,7 +43,7 @@ public function addComplexType($type) } // The following blocks define the Array of Object structure - return $this->_addArrayOfComplexType($singularType, $type); + return $this->addArrayOfComplexType($singularType, $type); } /** @@ -54,7 +54,7 @@ public function addComplexType($type) * @param string $type e.g. '\MyNamespace\MyClassname[]' * @return string tns:xsd-type e.g. 'tns:ArrayOfMyNamespace.MyClassname' */ - protected function _addArrayOfComplexType($singularType, $type) + protected function addArrayOfComplexType($singularType, $type) { if (($soapType = $this->scanRegisteredTypes($type)) !== null) { return $soapType; @@ -103,7 +103,7 @@ protected function _addArrayOfComplexType($singularType, $type) * @param string $type * @return string */ - protected function _getSingularPhpType($type) + protected function getSingularPhpType($type) { return str_replace('[]', '', $type); } @@ -114,7 +114,7 @@ protected function _getSingularPhpType($type) * @param string $type * @return int */ - protected function _getNestedCount($type) + protected function getNestedCount($type) { return substr_count($type, '[]'); } diff --git a/src/Wsdl/ComplexTypeStrategy/ArrayOfTypeSequence.php b/src/Wsdl/ComplexTypeStrategy/ArrayOfTypeSequence.php index 9085f089..181497d6 100644 --- a/src/Wsdl/ComplexTypeStrategy/ArrayOfTypeSequence.php +++ b/src/Wsdl/ComplexTypeStrategy/ArrayOfTypeSequence.php @@ -22,18 +22,18 @@ class ArrayOfTypeSequence extends DefaultComplexType */ public function addComplexType($type) { - $nestedCounter = $this->_getNestedCount($type); + $nestedCounter = $this->getNestedCount($type); if ($nestedCounter > 0) { - $singularType = $this->_getSingularType($type); + $singularType = $this->getSingularType($type); $complexType = ''; for ($i = 1; $i <= $nestedCounter; $i++) { - $complexType = $this->_getTypeBasedOnNestingLevel($singularType, $i); + $complexType = $this->getTypeBasedOnNestingLevel($singularType, $i); $complexTypePhp = $singularType . str_repeat('[]', $i); - $childType = $this->_getTypeBasedOnNestingLevel($singularType, $i-1); + $childType = $this->getTypeBasedOnNestingLevel($singularType, $i-1); - $this->_addSequenceType($complexType, $childType, $complexTypePhp); + $this->addSequenceType($complexType, $childType, $complexTypePhp); } return $complexType; @@ -56,14 +56,17 @@ public function addComplexType($type) * @param int $level * @return string */ - protected function _getTypeBasedOnNestingLevel($singularType, $level) + protected function getTypeBasedOnNestingLevel($singularType, $level) { if ($level == 0) { // This is not an Array anymore, return the xsd simple type return $this->getContext()->getType($singularType); } - return Wsdl::TYPES_NS . ':' . str_repeat('ArrayOf', $level) . ucfirst($this->getContext()->translateType($singularType)); + return Wsdl::TYPES_NS + . ':' + . str_repeat('ArrayOf', $level) + . ucfirst($this->getContext()->translateType($singularType)); } /** @@ -72,7 +75,7 @@ protected function _getTypeBasedOnNestingLevel($singularType, $level) * @param string $type * @return string */ - protected function _getSingularType($type) + protected function getSingularType($type) { return str_replace('[]', '', $type); } @@ -83,7 +86,7 @@ protected function _getSingularType($type) * @param string $type * @return int */ - protected function _getNestedCount($type) + protected function getNestedCount($type) { return substr_count($type, '[]'); } @@ -95,7 +98,7 @@ protected function _getNestedCount($type) * @param string $childType Qualified array items type (e.g. 'xsd:int', 'tns:ArrayOfInt') * @param string $phpArrayType PHP type (e.g. 'int[][]', '\MyNamespace\MyClassName[][][]') */ - protected function _addSequenceType($arrayType, $childType, $phpArrayType) + protected function addSequenceType($arrayType, $childType, $phpArrayType) { if ($this->scanRegisteredTypes($phpArrayType) !== null) { return; diff --git a/test/AutoDiscover/OnlineTest.php b/test/AutoDiscover/OnlineTest.php index e097b393..f41a71b6 100644 --- a/test/AutoDiscover/OnlineTest.php +++ b/test/AutoDiscover/OnlineTest.php @@ -9,21 +9,18 @@ namespace ZendTest\Soap\AutoDiscover; -require_once __DIR__ . '/../TestAsset/commontypes.php'; - use Zend\Soap\Client; -/** - * @group Zend_Soap - */ class OnlineTest extends \PHPUnit_Framework_TestCase { protected $baseuri; public function setUp() { - if (!getenv('TESTS_ZEND_SOAP_AUTODISCOVER_ONLINE_SERVER_BASEURI')) { - $this->markTestSkipped('Enable TESTS_ZEND_SOAP_AUTODISCOVER_ONLINE_SERVER_BASEURI to allow the Online test to work.'); + if (! getenv('TESTS_ZEND_SOAP_AUTODISCOVER_ONLINE_SERVER_BASEURI')) { + $this->markTestSkipped( + 'Enable TESTS_ZEND_SOAP_AUTODISCOVER_ONLINE_SERVER_BASEURI to allow the Online test to work.' + ); } $this->baseuri = getenv('TESTS_ZEND_SOAP_AUTODISCOVER_ONLINE_SERVER_BASEURI'); } @@ -45,10 +42,10 @@ public function testNestedObjectArrayResponse() $this->assertEquals(3, count($ret[0]->baz)); $baz = $ret[0]->baz; - $this->assertEquals("bar", $baz[0]->bar); - $this->assertEquals("bar", $baz[0]->foo); - $this->assertEquals("foo", $baz[1]->bar); - $this->assertEquals("foo", $baz[1]->foo); + $this->assertEquals("bar", $baz[0]->bar); + $this->assertEquals("bar", $baz[0]->foo); + $this->assertEquals("foo", $baz[1]->bar); + $this->assertEquals("foo", $baz[1]->foo); $this->assertEquals("test", $baz[2]->bar); $this->assertEquals("test", $baz[2]->foo); } diff --git a/test/AutoDiscoverTest.php b/test/AutoDiscoverTest.php index 855543ba..1c33c96c 100644 --- a/test/AutoDiscoverTest.php +++ b/test/AutoDiscoverTest.php @@ -9,20 +9,10 @@ namespace ZendTest\Soap; -/** Include Common TestTypes */ -require_once 'TestAsset/commontypes.php'; - use Zend\Soap\AutoDiscover; use Zend\Soap\Wsdl; use Zend\Uri\Uri; -/** PHPUnit Test Case */ - -/** - * Test cases for Zend\Soap\AutoDiscover - * - * @group Zend_Soap - */ class AutoDiscoverTest extends \PHPUnit_Framework_TestCase { /** @@ -129,7 +119,8 @@ public function testDocumentNodes($element = null) foreach ($element->childNodes as $node) { if (in_array($node->nodeType, [XML_ELEMENT_NODE])) { $this->assertNotEmpty( - $node->namespaceURI, 'Document element: ' + $node->namespaceURI, + 'Document element: ' . $node->nodeName . ' has no valid namespace. Line: ' . $node->getLineNo() ); @@ -161,7 +152,8 @@ public function testAutoDiscoverConstructorStrategy($strategy) $wsdl = $server->generate(); $this->assertEquals( - get_class($strategy), get_class($wsdl->getComplexTypeStrategy()) + get_class($strategy), + get_class($wsdl->getComplexTypeStrategy()) ); } @@ -200,7 +192,8 @@ public function testAutoDiscoverConstructorWsdlClass() $this->assertEquals('Zend\Soap\Wsdl', trim(get_class($wsdl), '\\')); $this->assertEquals( - 'Zend\Soap\Wsdl', trim($server->getWsdlClass(), '\\') + 'Zend\Soap\Wsdl', + trim($server->getWsdlClass(), '\\') ); } @@ -225,7 +218,8 @@ public function testSetServiceName($newName, $shouldBeValid) $this->server->setServiceName($newName); $this->bindWsdl($this->server->generate()); $this->assertSpecificNodeNumberInXPath( - 1, '/wsdl:definitions[@name="' . $newName . '"]' + 1, + '/wsdl:definitions[@name="' . $newName . '"]' ); } @@ -303,8 +297,10 @@ public function testSetClass() $this->bindWsdl($this->server->generate()); $this->assertSpecificNodeNumberInXPath( - 1, '//wsdl:types/xsd:schema[@targetNamespace="' - . $this->defaultServiceUri . '"]', 'Invalid schema definition' + 1, + '//wsdl:types/xsd:schema[@targetNamespace="' + . $this->defaultServiceUri . '"]', + 'Invalid schema definition' ); for ($i = 1; $i <= 4; $i++) { @@ -340,7 +336,8 @@ public function testSetClass() 'Invalid service binding definition' ); $this->assertEquals( - 'tns:MyServicePort', $nodes->item(0)->getAttribute('type'), + 'tns:MyServicePort', + $nodes->item(0)->getAttribute('type'), 'Invalid type attribute value in service binding definition' ); @@ -350,7 +347,8 @@ public function testSetClass() 'Invalid service binding definition' ); $this->assertEquals( - 'rpc', $nodes->item(0)->getAttribute('style'), + 'rpc', + $nodes->item(0)->getAttribute('style'), 'Invalid style attribute value in service binding definition' ); $this->assertEquals( @@ -383,20 +381,24 @@ public function testSetClass() "use" => "encoded", "encodingStyle" => "http://schemas.xmlsoap.org/soap/encoding/", "namespace" => "http://localhost/MyService.php" - ], $nodes + ], + $nodes ); $this->assertSpecificNodeNumberInXPath( - 1, '//wsdl:service[@name="MyServiceService"]', + 1, + '//wsdl:service[@name="MyServiceService"]', 'Invalid service definition' ); $this->assertSpecificNodeNumberInXPath( - 1, '//wsdl:service[@name="MyServiceService"]/' + 1, + '//wsdl:service[@name="MyServiceService"]/' . 'wsdl:port[@name="MyServicePort" and @binding="tns:MyServiceBinding"]', 'Invalid service port definition' ); $this->assertSpecificNodeNumberInXPath( - 1, '//wsdl:service[@name="MyServiceService"]/' + 1, + '//wsdl:service[@name="MyServiceService"]/' . 'wsdl:port[@name="MyServicePort" and @binding="tns:MyServiceBinding"]/soap:address[@location="' . $this->defaultServiceUri . '"]', 'Invalid service address definition' @@ -404,13 +406,15 @@ public function testSetClass() $nodes = $this->assertSpecificNodeNumberInXPath( - 1, '//wsdl:message[@name="testFunc1In"]', + 1, + '//wsdl:message[@name="testFunc1In"]', 'Invalid message definition' ); $this->assertFalse($nodes->item(0)->hasChildNodes()); $this->assertSpecificNodeNumberInXPath( - 1, '//wsdl:message[@name="testFunc2In"]', + 1, + '//wsdl:message[@name="testFunc2In"]', 'Invalid message definition' ); $this->assertSpecificNodeNumberInXPath( @@ -420,7 +424,8 @@ public function testSetClass() ); $this->assertSpecificNodeNumberInXPath( - 1, '//wsdl:message[@name="testFunc2Out"]', + 1, + '//wsdl:message[@name="testFunc2Out"]', 'Invalid message definition' ); $this->assertSpecificNodeNumberInXPath( @@ -431,17 +436,22 @@ public function testSetClass() $this->assertSpecificNodeNumberInXPath( - 1, '//wsdl:message[@name="testFunc3In"]', + 1, + '//wsdl:message[@name="testFunc3In"]', 'Invalid message definition' ); + + // @codingStandardsIgnoreStart $this->assertSpecificNodeNumberInXPath( 2, '//wsdl:message[@name="testFunc3In"][(wsdl:part[@name="who" and @type="xsd:string"]) or (wsdl:part[@name="when" and @type="xsd:int"])]/wsdl:part', 'Invalid message definition' ); + // @codingStandardsIgnoreEnd $this->assertSpecificNodeNumberInXPath( - 1, '//wsdl:message[@name="testFunc3Out"]', + 1, + '//wsdl:message[@name="testFunc3Out"]', 'Invalid message definition' ); $this->assertSpecificNodeNumberInXPath( @@ -452,7 +462,8 @@ public function testSetClass() $nodes = $this->assertSpecificNodeNumberInXPath( - 1, '//wsdl:message[@name="testFunc4In"]', + 1, + '//wsdl:message[@name="testFunc4In"]', 'Invalid message definition' ); $this->assertFalse($nodes->item(0)->hasChildNodes()); @@ -481,7 +492,8 @@ public function testSetClassWithDifferentStyles() $this->bindWsdl($this->server->generate()); $this->assertSpecificNodeNumberInXPath( - 1, '//wsdl:types/xsd:schema/xsd:element[@name="testFunc1"]', + 1, + '//wsdl:types/xsd:schema/xsd:element[@name="testFunc1"]', 'Missing test func1 definition' ); $this->assertSpecificNodeNumberInXPath( @@ -505,12 +517,14 @@ public function testSetClassWithDifferentStyles() [ 'name' => "testFunc1Result", 'type' => "xsd:string", - ], $nodes + ], + $nodes ); $this->assertSpecificNodeNumberInXPath( - 1, '//wsdl:types/xsd:schema/xsd:element[@name="testFunc2"]', + 1, + '//wsdl:types/xsd:schema/xsd:element[@name="testFunc2"]', 'Missing test func2 definition' ); $this->assertSpecificNodeNumberInXPath( @@ -528,7 +542,8 @@ public function testSetClassWithDifferentStyles() [ 'name' => "who", 'type' => "xsd:string", - ], $nodes + ], + $nodes ); $nodes = $this->assertSpecificNodeNumberInXPath( @@ -541,12 +556,14 @@ public function testSetClassWithDifferentStyles() [ 'name' => "testFunc2Result", 'type' => "xsd:string", - ], $nodes + ], + $nodes ); $this->assertSpecificNodeNumberInXPath( - 1, '//wsdl:types/xsd:schema/xsd:element[@name="testFunc3"]', + 1, + '//wsdl:types/xsd:schema/xsd:element[@name="testFunc3"]', 'Missing test func3 definition' ); $this->assertSpecificNodeNumberInXPath( @@ -583,12 +600,14 @@ public function testSetClassWithDifferentStyles() [ 'name' => "testFunc3Result", 'type' => "xsd:string", - ], $nodes + ], + $nodes ); $this->assertSpecificNodeNumberInXPath( - 1, '//wsdl:types/xsd:schema/xsd:element[@name="testFunc4"]', + 1, + '//wsdl:types/xsd:schema/xsd:element[@name="testFunc4"]', 'Missing test func1 definition' ); $this->assertSpecificNodeNumberInXPath( @@ -612,7 +631,8 @@ public function testSetClassWithDifferentStyles() [ 'name' => "testFunc4Result", 'type' => "xsd:string", - ], $nodes + ], + $nodes ); @@ -688,12 +708,14 @@ public function testSetClassWithDifferentStyles() for ($i = 1; $i <= 4; $i++) { $this->assertSpecificNodeNumberInXPath( - 1, '//wsdl:message[@name="testFunc' . $i + 1, + '//wsdl:message[@name="testFunc' . $i . 'In"]/wsdl:part[@name="parameters" and @element="tns:testFunc' . $i . '"]', 'Missing test testFunc' . $i . ' input message definition' ); $this->assertSpecificNodeNumberInXPath( - 1, '//wsdl:message[@name="testFunc' . $i + 1, + '//wsdl:message[@name="testFunc' . $i . 'Out"]/wsdl:part[@name="parameters" and @element="tns:testFunc' . $i . 'Response"]', 'Missing test testFunc' . $i . ' output message definition' ); @@ -851,7 +873,8 @@ public function testAddFunctionSimpleWithDifferentStyle() $this->assertSpecificNodeNumberInXPath( 1, '//wsdl:types/xsd:schema[@targetNamespace="' - . $this->defaultServiceUri . '"]', 'Missing service port definition' + . $this->defaultServiceUri . '"]', + 'Missing service port definition' ); $this->assertSpecificNodeNumberInXPath( @@ -863,7 +886,7 @@ public function testAddFunctionSimpleWithDifferentStyle() ); $this->assertSpecificNodeNumberInXPath( 1, - '//wsdl:types/xsd:schema[@targetNamespace="' . $this->defaultServiceUri + '//wsdl:types/xsd:schema[@targetNamespace="' . $this->defaultServiceUri . '"]/xsd:element[@name="TestFuncResponse"]/xsd:complexType/xsd:sequence' . '/xsd:element[@name="TestFuncResult" and @type="xsd:string"]', 'Missing complex type definition' @@ -961,8 +984,10 @@ public function testAddFunctionSimpleInReturnNameCompabilityMode() $this->bindWsdl($this->server->generate()); $this->assertSpecificNodeNumberInXPath( - 1, '//wsdl:types/xsd:schema[@targetNamespace="' - . $this->defaultServiceUri . '"]', 'Missing service port definition' + 1, + '//wsdl:types/xsd:schema[@targetNamespace="' + . $this->defaultServiceUri . '"]', + 'Missing service port definition' ); @@ -1068,8 +1093,10 @@ public function testAddFunctionMultiple() $this->assertSpecificNodeNumberInXPath( - 1, '//wsdl:types/xsd:schema[@targetNamespace="' - . $this->defaultServiceUri . '"]', 'Missing service port definition' + 1, + '//wsdl:types/xsd:schema[@targetNamespace="' + . $this->defaultServiceUri . '"]', + 'Missing service port definition' ); @@ -1152,11 +1179,13 @@ public function testAddFunctionMultiple() $this->assertSpecificNodeNumberInXPath( - 1, '//wsdl:message[@name="TestFunc' . $i . 'In"]', + 1, + '//wsdl:message[@name="TestFunc' . $i . 'In"]', 'Missing test testFunc' . $i . ' input message definition' ); $this->assertSpecificNodeNumberInXPath( - 1, '//wsdl:message[@name="TestFunc' . $i . 'Out"]', + 1, + '//wsdl:message[@name="TestFunc' . $i . 'Out"]', 'Missing test testFunc' . $i . ' input message definition' ); } @@ -1184,7 +1213,8 @@ public function testChangeWsdlUriInConstructor($uri, $expectedUri) $this->dom->documentElement->getAttribute('targetNamespace') ); $this->assertNotContains( - $this->defaultServiceUri, $this->dom->saveXML() + $this->defaultServiceUri, + $this->dom->saveXML() ); @@ -1208,16 +1238,18 @@ public function testSetNonStringNonZendUriUriThrowsException() * @dataProvider dataProviderValidUris */ public function testChangingWsdlUriAfterGenerationIsPossible( - $uri, $expectedUri + $uri, + $expectedUri ) { $this->server->addFunction('\ZendTest\Soap\TestAsset\TestFunc'); $wsdl = $this->server->generate(); $wsdl->setUri($uri); $this->assertEquals( - $expectedUri, $wsdl->toDomDocument()->documentElement->getAttribute( - 'targetNamespace' - ) + $expectedUri, + $wsdl->toDomDocument()->documentElement->getAttribute( + 'targetNamespace' + ) ); $this->assertValidWSDL($wsdl->toDomDocument()); @@ -1253,8 +1285,8 @@ public function dataProviderValidUris() * @group ZF-4125 * */ - public function testUsingClassWithMethodsWithMultipleDefaultParameterValues( - ) { + public function testUsingClassWithMethodsWithMultipleDefaultParameterValues() + { $this->server->setClass( '\ZendTest\Soap\TestAsset\TestFixingMultiplePrototypes' ); @@ -1262,10 +1294,12 @@ public function testUsingClassWithMethodsWithMultipleDefaultParameterValues( $this->assertSpecificNodeNumberInXPath( - 1, '//wsdl:message[@name="testFuncIn"]' + 1, + '//wsdl:message[@name="testFuncIn"]' ); $this->assertSpecificNodeNumberInXPath( - 1, '//wsdl:message[@name="testFuncOut"]' + 1, + '//wsdl:message[@name="testFuncOut"]' ); @@ -1293,11 +1327,13 @@ public function testComplexTypesThatAreUsedMultipleTimesAreRecoginzedOnce() 'Definition of TestClass1 has to occour once.' ); $this->assertSpecificNodeNumberInXPath( - 1, '//xsd:complexType[@name="AutoDiscoverTestClass1"]', + 1, + '//xsd:complexType[@name="AutoDiscoverTestClass1"]', 'AutoDiscoverTestClass1 has to be defined once.' ); $this->assertSpecificNodeNumberInXPath( - 1, '//xsd:complexType[@name="ArrayOfAutoDiscoverTestClass1"]', + 1, + '//xsd:complexType[@name="ArrayOfAutoDiscoverTestClass1"]', 'AutoDiscoverTestClass1 should be defined once.' ); $nodes = $this->assertSpecificNodeNumberInXPath( @@ -1319,8 +1355,8 @@ public function testComplexTypesThatAreUsedMultipleTimesAreRecoginzedOnce() /** * @group ZF-5604 */ - public function testReturnSameArrayOfObjectsResponseOnDifferentMethodsWhenArrayComplex( - ) { + public function testReturnSameArrayOfObjectsResponseOnDifferentMethodsWhenArrayComplex() + { $this->server->setComplexTypeStrategy( new \Zend\Soap\Wsdl\ComplexTypeStrategy\ArrayOfTypeComplex ); @@ -1329,10 +1365,12 @@ public function testReturnSameArrayOfObjectsResponseOnDifferentMethodsWhenArrayC $this->assertSpecificNodeNumberInXPath( - 1, '//xsd:complexType[@name="ArrayOfMyResponse"]' + 1, + '//xsd:complexType[@name="ArrayOfMyResponse"]' ); $this->assertSpecificNodeNumberInXPath( - 0, '//wsdl:part[@type="tns:My_Response[]"]' + 0, + '//wsdl:part[@type="tns:My_Response[]"]' ); @@ -1343,8 +1381,8 @@ public function testReturnSameArrayOfObjectsResponseOnDifferentMethodsWhenArrayC /** * @group ZF-5430 */ - public function testReturnSameArrayOfObjectsResponseOnDifferentMethodsWhenArraySequence( - ) { + public function testReturnSameArrayOfObjectsResponseOnDifferentMethodsWhenArraySequence() + { $this->server->setComplexTypeStrategy( new \Zend\Soap\Wsdl\ComplexTypeStrategy\ArrayOfTypeSequence ); @@ -1353,13 +1391,16 @@ public function testReturnSameArrayOfObjectsResponseOnDifferentMethodsWhenArrayS $this->assertSpecificNodeNumberInXPath( - 1, '//xsd:complexType[@name="ArrayOfString"]' + 1, + '//xsd:complexType[@name="ArrayOfString"]' ); $this->assertSpecificNodeNumberInXPath( - 1, '//xsd:complexType[@name="ArrayOfArrayOfString"]' + 1, + '//xsd:complexType[@name="ArrayOfArrayOfString"]' ); $this->assertSpecificNodeNumberInXPath( - 1, '//xsd:complexType[@name="ArrayOfArrayOfArrayOfString"]' + 1, + '//xsd:complexType[@name="ArrayOfArrayOfArrayOfString"]' ); @@ -1380,10 +1421,12 @@ public function testNoReturnIsOneWayCallInSetClass() $this->assertSpecificNodeNumberInXPath( - 1, '//wsdl:portType/wsdl:operation[@name="pushOneWay"]/wsdl:input' + 1, + '//wsdl:portType/wsdl:operation[@name="pushOneWay"]/wsdl:input' ); $this->assertSpecificNodeNumberInXPath( - 0, '//wsdl:portType/wsdl:operation[@name="pushOneWay"]/wsdl:output' + 0, + '//wsdl:portType/wsdl:operation[@name="pushOneWay"]/wsdl:output' ); @@ -1401,10 +1444,12 @@ public function testNoReturnIsOneWayCallInAddFunction() $this->assertSpecificNodeNumberInXPath( - 1, '//wsdl:portType/wsdl:operation[@name="OneWay"]/wsdl:input' + 1, + '//wsdl:portType/wsdl:operation[@name="OneWay"]/wsdl:input' ); $this->assertSpecificNodeNumberInXPath( - 0, '//wsdl:portType/wsdl:operation[@name="OneWay"]/wsdl:output' + 0, + '//wsdl:portType/wsdl:operation[@name="OneWay"]/wsdl:output' ); @@ -1485,7 +1530,8 @@ public function assertAttributesOfNodes($attributes, $nodeList) foreach ($nodeList as $node) { for ($i = 0; $i < $c; $i++) { $this->assertEquals( - $attributes[$keys[$i]], $node->getAttribute($keys[$i]), + $attributes[$keys[$i]], + $node->getAttribute($keys[$i]), 'Invalid attribute value.' ); } diff --git a/test/Client/DotNetTest.php b/test/Client/DotNetTest.php index 2e7c564b..66ef281f 100644 --- a/test/Client/DotNetTest.php +++ b/test/Client/DotNetTest.php @@ -12,8 +12,7 @@ use PHPUnit_Framework_TestCase; use Zend\Soap\Client\Common; use Zend\Soap\Client\DotNet as DotNetClient; - -require_once __DIR__ . '/../TestAsset/call_user_func.php'; +use ZendTest\Soap\TestAsset\MockCallUserFunc; /** * .NET SOAP client tester. @@ -43,8 +42,24 @@ class DotNetTest extends PHPUnit_Framework_TestCase */ protected function setUp() { - $this->client = new DotNetClient(null, ['location' => 'http://unithost/test', - 'uri' => 'http://unithost/test']); + MockCallUserFunc::$mock = false; + $this->client = new DotNetClient( + null, + [ + 'location' => 'http://unithost/test', + 'uri' => 'http://unithost/test' + ] + ); + } + + /** + * Disables mocking of call_user_func + * + * @return void + */ + protected function tearDown() + { + MockCallUserFunc::$mock = false; } /** @@ -166,8 +181,10 @@ public function testLastResponseHeadersCanBeFetchedCorrectly() */ private function mockCurlClient() { - $this->curlClient = $this->getMock('Zend\Http\Client\Adapter\Curl', - ['close', 'connect', 'read', 'write']); + $this->curlClient = $this->getMock( + 'Zend\Http\Client\Adapter\Curl', + ['close', 'connect', 'read', 'write'] + ); $this->client->setCurlClient($this->curlClient); } @@ -178,38 +195,52 @@ private function mockCurlClient() */ private function mockNtlmRequest() { - $headers = ['Content-Type' => 'text/xml; charset=utf-8', - 'Method' => 'POST', - 'SOAPAction' => '"http://unithost/test#TestMethod"', - 'User-Agent' => 'PHP-SOAP-CURL']; + $headers = [ + 'Content-Type' => 'text/xml; charset=utf-8', + 'Method' => 'POST', + 'SOAPAction' => '"http://unithost/test#TestMethod"', + 'User-Agent' => 'PHP-SOAP-CURL', + ]; $response = "HTTP/1.1 200 OK\n" - . "Cache-Control: private\n" - . "Content-Type: text/xml; charset=utf-8\n" - . "\n\n" - . '' - . '' - . '' - . '' - . '' - . '' - . '' - . '' - . ''; + . "Cache-Control: private\n" + . "Content-Type: text/xml; charset=utf-8\n" + . "\n\n" + . '' + . '' + . '' + . '' + . '' + . '' + . '' + . '' + . ''; $this->mockCurlClient(); - $this->curlClient->expects($this->once()) - ->method('connect') - ->with('unithost', 80); - $this->curlClient->expects($this->once()) - ->method('read') - ->will($this->returnValue($response)); - $this->curlClient->expects($this->any()) - ->method('write') - ->with('POST', $this->isInstanceOf('Zend\Uri\Http'), 1.1, $headers, $this->stringContains('client->setOptions(['authentication' => 'ntlm', - 'login' => 'username', - 'password' => 'testpass']); + $this->curlClient + ->expects($this->once()) + ->method('connect') + ->with('unithost', 80); + $this->curlClient + ->expects($this->once()) + ->method('read') + ->will($this->returnValue($response)); + $this->curlClient + ->expects($this->any()) + ->method('write') + ->with( + 'POST', + $this->isInstanceOf('Zend\Uri\Http'), + 1.1, + $headers, + $this->stringContains('client->setOptions([ + 'authentication' => 'ntlm', + 'login' => 'username', + 'password' => 'testpass' + ]); } } diff --git a/test/ClientTest.php b/test/ClientTest.php index 51a734d9..f0208fc0 100644 --- a/test/ClientTest.php +++ b/test/ClientTest.php @@ -9,16 +9,11 @@ namespace ZendTest\Soap; -require_once __DIR__ . '/TestAsset/commontypes.php'; - use Zend\Soap\AutoDiscover; use Zend\Soap\Client; use Zend\Soap\Server; use Zend\Soap\Wsdl; -/** - * @group Zend_Soap - */ class ClientTest extends \PHPUnit_Framework_TestCase { public function setUp() @@ -301,7 +296,9 @@ public function testGetTypes() $count = 0; foreach ($typesArray as $element) { - if (strpos($element, 'struct AutoDiscoverTestClass1') === 0 or strpos($element, 'AutoDiscoverTestClass1 ArrayOfAutoDiscoverTestClass1') === 0) { + if (strpos($element, 'struct AutoDiscoverTestClass1') === 0 + || strpos($element, 'AutoDiscoverTestClass1 ArrayOfAutoDiscoverTestClass1') === 0 + ) { $count++; } } @@ -316,10 +313,14 @@ public function testGetTypes() public function testGetLastRequest() { if (headers_sent($file, $line)) { - $this->markTestSkipped('Cannot run testGetLastRequest() when headers have already been sent. Output started in '.$file.'@'.$line.' enable output buffering to run this test'); - - return; + $this->markTestSkipped(sprintf( + 'Cannot run testGetLastRequest() when headers have already been sent. ' + . 'Output started in %s@%d; enable output buffering to run this test', + $file, + $line + )); } + $server = new Server(__DIR__ . '/TestAsset/wsdl_example.wsdl'); $server->setClass('\ZendTest\Soap\TestAsset\TestClass'); @@ -346,9 +347,10 @@ public function testGetLastRequest() public function testGetLastResponse() { if (headers_sent()) { - $this->markTestSkipped('Cannot run testGetLastResponse() when headers have already been sent; enable output buffering to run this test'); - - return; + $this->markTestSkipped( + 'Cannot run testGetLastResponse() when headers have already been sent; ' + . 'enable output buffering to run this test' + ); } $server = new Server(__DIR__ . '/TestAsset/wsdl_example.wsdl'); @@ -360,17 +362,17 @@ public function testGetLastResponse() $client->testFunc2('World'); $expectedResponse = '' . "\n" - . '' - . '' - . '' - . 'testFunc2Return' - . 'Hello World!' - . '' - . '' - . '' . "\n"; + . '' + . '' + . '' + . 'testFunc2Return' + . 'Hello World!' + . '' + . '' + . '' . "\n"; $this->assertEquals($client->getLastResponse(), $expectedResponse); } @@ -378,9 +380,10 @@ public function testGetLastResponse() public function testCallInvoke() { if (headers_sent()) { - $this->markTestSkipped('Cannot run testCallInvoke() when headers have already been sent; enable output buffering to run this test'); - - return; + $this->markTestSkipped( + 'Cannot run testCallInvoke() when headers have already been sent; ' + . 'enable output buffering to run this test' + ); } $server = new Server(__DIR__ . '/TestAsset/wsdl_example.wsdl'); @@ -394,9 +397,10 @@ public function testCallInvoke() public function testCallDirect() { if (headers_sent()) { - $this->markTestSkipped('Cannot run testCallInvoke() when headers have already been sent; enable output buffering to run this test'); - - return; + $this->markTestSkipped( + 'Cannot run testCallInvoke() when headers have already been sent; ' + . 'enable output buffering to run this test' + ); } $server = new Server(__DIR__ . '/TestAsset/wsdl_example.wsdl'); @@ -410,9 +414,10 @@ public function testCallDirect() public function testCallDirectWithArgString() { if (headers_sent()) { - $this->markTestSkipped('Cannot run testCallInvoke() when headers have already been sent; enable output buffering to run this test'); - - return; + $this->markTestSkipped( + 'Cannot run testCallInvoke() when headers have already been sent; ' + . 'enable output buffering to run this test' + ); } $server = new Server(__DIR__ . '/TestAsset/wsdl_example.wsdl'); @@ -462,9 +467,10 @@ public function testSetOptionsWithZendConfig() public function testSetInputHeaders() { if (headers_sent()) { - $this->markTestSkipped('Cannot run testSetInputHeaders() when headers have already been sent; enable output buffering to run this test'); - - return; + $this->markTestSkipped( + 'Cannot run testSetInputHeaders() when headers have already been sent; ' + . 'enable output buffering to run this test' + ); } $server = new Server(__DIR__ . '/TestAsset/wsdl_example.wsdl'); @@ -473,9 +479,18 @@ public function testSetInputHeaders() $client = new Client\Local($server, __DIR__ . '/TestAsset/wsdl_example.wsdl'); // Add request header - $client->addSoapInputHeader(new \SoapHeader('http://www.example.com/namespace', 'MyHeader1', 'SOAP header content 1')); + $client->addSoapInputHeader(new \SoapHeader( + 'http://www.example.com/namespace', + 'MyHeader1', + 'SOAP header content 1' + )); + // Add permanent request header - $client->addSoapInputHeader(new \SoapHeader('http://www.example.com/namespace', 'MyHeader2', 'SOAP header content 2'), true); + $client->addSoapInputHeader(new \SoapHeader( + 'http://www.example.com/namespace', + 'MyHeader2', + 'SOAP header content 2' + ), true); // Perform request $client->testFunc2('World'); @@ -500,7 +515,9 @@ public function testSetInputHeaders() $this->assertEquals($client->getLastRequest(), $expectedRequest); // Add request header - $client->addSoapInputHeader(new \SoapHeader('http://www.example.com/namespace', 'MyHeader3', 'SOAP header content 3')); + $client->addSoapInputHeader( + new \SoapHeader('http://www.example.com/namespace', 'MyHeader3', 'SOAP header content 3') + ); // Perform request $client->testFunc2('World'); @@ -527,7 +544,9 @@ public function testSetInputHeaders() $client->resetSoapInputHeaders(); // Add request header - $client->addSoapInputHeader(new \SoapHeader('http://www.example.com/namespace', 'MyHeader4', 'SOAP header content 4')); + $client->addSoapInputHeader( + new \SoapHeader('http://www.example.com/namespace', 'MyHeader4', 'SOAP header content 4') + ); // Perform request $client->testFunc2('World'); @@ -559,7 +578,14 @@ public function testSetCookieIsDelegatedToSoapClient() $fixtureCookieKey = "foo"; $fixtureCookieValue = "bar"; - $clientMock = $this->getMock('SoapClient', ['__setCookie'], [null, ['uri' => 'http://www.zend.com', 'location' => 'http://www.zend.com']]); + $clientMock = $this->getMock( + 'SoapClient', + ['__setCookie'], + [ + null, + ['uri' => 'http://www.zend.com', 'location' => 'http://www.zend.com'] + ] + ); $clientMock->expects($this->once()) ->method('__setCookie') ->with($fixtureCookieKey, $fixtureCookieValue); @@ -572,7 +598,14 @@ public function testSetCookieIsDelegatedToSoapClient() public function testSetSoapClient() { - $clientMock = $this->getMock('SoapClient', ['__setCookie'], [null, ['uri' => 'http://www.zend.com', 'location' => 'http://www.zend.com']]); + $clientMock = $this->getMock( + 'SoapClient', + ['__setCookie'], + [ + null, + ['uri' => 'http://www.zend.com', 'location' => 'http://www.zend.com'] + ] + ); $soap = new Client(); $soap->setSoapClient($clientMock); diff --git a/test/ServerTest.php b/test/ServerTest.php index fee30be2..277ea7f0 100644 --- a/test/ServerTest.php +++ b/test/ServerTest.php @@ -9,17 +9,9 @@ namespace ZendTest\Soap; -require_once __DIR__ . '/TestAsset/commontypes.php'; - use Zend\Soap\AutoDiscover; use Zend\Soap\Server; -/** - * Zend_Soap_Server - * - * @group Zend_Soap - * @group Zend_Soap_Server - */ class ServerTest extends \PHPUnit_Framework_TestCase { public function setUp() @@ -277,10 +269,16 @@ public function testAddBogusFunctionsAsArray() { $server = new Server(); - $functions = ['\ZendTest\Soap\TestAsset\TestFunc5', - 'bogus_function', - '\ZendTest\Soap\TestAsset\TestFunc6']; - $this->setExpectedException('Zend\Soap\Exception\InvalidArgumentException', 'One or more invalid functions specified in array'); + $functions = [ + '\ZendTest\Soap\TestAsset\TestFunc5', + 'bogus_function', + '\ZendTest\Soap\TestAsset\TestFunc6' + ]; + + $this->setExpectedException( + 'Zend\Soap\Exception\InvalidArgumentException', + 'One or more invalid functions specified in array' + ); $server->addFunction($functions); } @@ -349,7 +347,10 @@ public function testSetBogusClassWithUnknownClassName() { $server = new Server(); - $this->setExpectedException('Zend\Soap\Exception\InvalidArgumentException', 'Class "Zend_Soap_Server_Test_BogusClass" does not exist'); + $this->setExpectedException( + 'Zend\Soap\Exception\InvalidArgumentException', + 'Class "Zend_Soap_Server_Test_BogusClass" does not exist' + ); $server->setClass('Zend_Soap_Server_Test_BogusClass'); } @@ -372,7 +373,10 @@ public function testSetObjectThrowsExceptionWithBadInput1() { $server = new Server(); - $this->setExpectedException('Zend\Soap\Exception\InvalidArgumentException', 'Invalid object argument (integer)'); + $this->setExpectedException( + 'Zend\Soap\Exception\InvalidArgumentException', + 'Invalid object argument (integer)' + ); $server->setObject(465); } @@ -383,7 +387,10 @@ public function testSetObjectThrowsExceptionWithBadInput2() { $server = new Server(); - $this->setExpectedException('Zend\Soap\Exception\InvalidArgumentException', 'Invalid object argument (integer)'); + $this->setExpectedException( + 'Zend\Soap\Exception\InvalidArgumentException', + 'Invalid object argument (integer)' + ); $int = 1; $server->setObject($int); } @@ -464,7 +471,10 @@ public function testSetUnknownPersistenceStateThrowsException() { $server = new Server(); - $this->setExpectedException('Zend\Soap\Exception\InvalidArgumentException', 'Invalid persistence mode specified'); + $this->setExpectedException( + 'Zend\Soap\Exception\InvalidArgumentException', + 'Invalid persistence mode specified' + ); $server->setPersistence('bogus'); } @@ -480,8 +490,11 @@ public function testGetPersistence() public function testGetLastRequest() { if (headers_sent()) { - $this->markTestSkipped('Cannot run testGetLastRequest() when headers have already been sent; enable output buffering to run this test'); - return; + $this->markTestSkipped(sprintf( + 'Cannot run %s() when headers have already been sent; ' + . 'enable output buffering to run this test', + __METHOD__ + )); } $server = new Server(); @@ -535,8 +548,11 @@ public function testGetReturnResponse() public function testGetLastResponse() { if (headers_sent()) { - $this->markTestSkipped('Cannot run testGetLastResponse() when headers have already been sent; enable output buffering to run this test'); - return; + $this->markTestSkipped(sprintf( + 'Cannot run %s() when headers have already been sent; ' + . 'enable output buffering to run this test', + __METHOD__ + )); } $server = new Server(); @@ -587,8 +603,11 @@ public function testHandle() } if (headers_sent()) { - $this->markTestSkipped('Cannot run testHandle() when headers have already been sent; enable output buffering to run this test'); - return; + $this->markTestSkipped(sprintf( + 'Cannot run %s() when headers have already been sent; ' + . 'enable output buffering to run this test', + __METHOD__ + )); } $server = new Server(); @@ -791,8 +810,11 @@ public function testFaultWithIntegerFailureCodeDoesNotBreakClassSoapFault() public function testHandlePhpErrors() { if (headers_sent()) { - $this->markTestSkipped('Cannot run ' . __METHOD__ . '() when headers have already been sent; enable output buffering to run this test'); - return; + $this->markTestSkipped(sprintf( + 'Cannot run %s() when headers have already been sent; ' + . 'enable output buffering to run this test', + __METHOD__ + )); } $wsdlFilename = __DIR__ . '/TestAsset/testHandlePhpErrors.wsdl'; @@ -836,8 +858,11 @@ public function testLoadFunctionsIsNotImplemented() public function testErrorHandlingOfSoapServerChangesToThrowingSoapFaultWhenInHandleMode() { if (headers_sent()) { - $this->markTestSkipped('Cannot run ' . __METHOD__ . '() when headers have already been sent; enable output buffering to run this test'); - return; + $this->markTestSkipped(sprintf( + 'Cannot run %s() when headers have already been sent; ' + . 'enable output buffering to run this test', + __METHOD__ + )); } $server = new Server(); diff --git a/test/TestAsset/MockCallUserFunc.php b/test/TestAsset/MockCallUserFunc.php index 9b3478d0..2adc105e 100644 --- a/test/TestAsset/MockCallUserFunc.php +++ b/test/TestAsset/MockCallUserFunc.php @@ -26,5 +26,5 @@ class MockCallUserFunc * * @var array */ - public static $params = array(); + public static $params = []; } diff --git a/test/TestAsset/call_user_func.php b/test/TestAsset/call_user_func.php index 867d9faf..e9a79489 100644 --- a/test/TestAsset/call_user_func.php +++ b/test/TestAsset/call_user_func.php @@ -8,6 +8,7 @@ */ namespace Zend\Soap; + use ZendTest\Soap\TestAsset\MockCallUserFunc; /** @@ -17,7 +18,7 @@ */ function call_user_func() { - if (!MockCallUserFunc::$mock) { + if (! MockCallUserFunc::$mock) { return call_user_func_array('\call_user_func', func_get_args()); } diff --git a/test/TestAsset/commontypes.php b/test/TestAsset/commontypes.php index e7799985..d22882e3 100644 --- a/test/TestAsset/commontypes.php +++ b/test/TestAsset/commontypes.php @@ -1,4 +1,4 @@ - 'bar', 'baz' => true, 1 => false, 'bat' => 123); + return ['foo' => 'bar', 'baz' => true, 1 => false, 'bat' => 123]; } /** @@ -87,7 +87,7 @@ function TestFunc7() */ function TestFunc8() { - $return = (object) array('foo' => 'bar', 'baz' => true, 'bat' => 123, 'qux' => false); + $return = (object) ['foo' => 'bar', 'baz' => true, 'bat' => 123, 'qux' => false]; return $return; } @@ -113,7 +113,7 @@ class TestFixingMultiplePrototypes * @param integer $d * @return integer */ - public function testFunc($a=100, $b=200, $d=300) + public function testFunc($a = 100, $b = 200, $d = 300) { } @@ -195,10 +195,10 @@ public function add(AutoDiscoverTestClass1 $test) */ public function fetchAll() { - return array( + return [ new AutoDiscoverTestClass1(), new AutoDiscoverTestClass1(), - ); + ]; } /** @@ -227,7 +227,7 @@ class ComplexTypeA /** * @var \ZendTest\Soap\TestAsset\ComplexTypeB[] */ - public $baz = array(); + public $baz = []; } class ComplexTest @@ -258,7 +258,7 @@ class ComplexObjectStructure /** * @var array */ - public $array = array(1, 2, 3); + public $array = [1, 2, 3]; } class ComplexObjectWithObjectStructure @@ -347,7 +347,9 @@ class Recursion /** * @return \ZendTest\Soap\TestAsset\Recursion */ - public function create() {} + public function create() + { + } } /** @@ -426,14 +428,14 @@ class TestData1 * * @var string */ - public $property1; + public $property1; /** * Property2 * * @var float */ - public $property2; + public $property2; } /** Test class 2 */ @@ -444,14 +446,14 @@ class TestData2 * * @var integer */ - public $property1; + public $property1; /** * Property1 * * @var float */ - public $property2; + public $property2; } class MockSoapServer @@ -461,7 +463,9 @@ public function handle() { $this->handle = func_get_args(); } - public function __call($name, $args) {} + public function __call($name, $args) + { + } } class MockServer extends \Zend\Soap\Server @@ -534,39 +538,39 @@ public function testFunc5() if (extension_loaded('soap')) { -/** Local SOAP client */ -class TestLocalSoapClient extends \SoapClient -{ - /** - * Server object - * - * @var \Zend\Soap\Server - */ - public $server; - - /** - * Local client constructor - * - * @param Zend_Soap_Server $server - * @param string $wsdl - * @param array $options - */ - public function __construct(\Zend\Soap\Server $server, $wsdl, $options) + /** Local SOAP client */ + class TestLocalSoapClient extends \SoapClient { - $this->server = $server; - parent::__construct($wsdl, $options); + /** + * Server object + * + * @var \Zend\Soap\Server + */ + public $server; + + /** + * Local client constructor + * + * @param Zend_Soap_Server $server + * @param string $wsdl + * @param array $options + */ + public function __construct(\Zend\Soap\Server $server, $wsdl, $options) + { + $this->server = $server; + parent::__construct($wsdl, $options); + } + + public function __doRequest($request, $location, $action, $version, $one_way = 0) + { + ob_start(); + $this->server->handle($request); + $response = ob_get_clean(); + + return $response; + } } - public function __doRequest($request, $location, $action, $version, $one_way = 0) - { - ob_start(); - $this->server->handle($request); - $response = ob_get_clean(); - - return $response; - } -} - } class SequenceTest @@ -577,8 +581,6 @@ class SequenceTest public $var = 5; } - - class Book { /** @@ -586,6 +588,7 @@ class Book */ public $somevar; } + class Cookie { /** @@ -593,12 +596,11 @@ class Cookie */ public $othervar; } + class Anything { } - - class PublicPrivateProtected { const PROTECTED_VAR_NAME = 'bar'; diff --git a/test/TestAsset/fulltests/server1.php b/test/TestAsset/fulltests/server1.php index 56f284d9..44dae772 100644 --- a/test/TestAsset/fulltests/server1.php +++ b/test/TestAsset/fulltests/server1.php @@ -31,7 +31,7 @@ public function request($request) $a->baz[] = $request; - return array($a); + return [$a]; } } @@ -52,7 +52,7 @@ class ComplexTypeA /** * @var \ZendTest\Soap\TestAsset\fulltests\ComplexTypeB[] */ - public $baz = array(); + public $baz = []; } if (isset($_GET['wsdl'])) { diff --git a/test/Wsdl/ArrayOfTypeComplexStrategyTest.php b/test/Wsdl/ArrayOfTypeComplexStrategyTest.php index 35d0bb24..55b7e387 100644 --- a/test/Wsdl/ArrayOfTypeComplexStrategyTest.php +++ b/test/Wsdl/ArrayOfTypeComplexStrategyTest.php @@ -9,16 +9,10 @@ namespace ZendTest\Soap\Wsdl; -require_once __DIR__ . "/../TestAsset/commontypes.php"; - use Zend\Soap\Wsdl; use Zend\Soap\Wsdl\ComplexTypeStrategy\ArrayOfTypeComplex; use ZendTest\Soap\WsdlTestHelper; -/** - * @group Zend_Soap - * @group Zend_Soap_Wsdl - */ class ArrayOfTypeComplexStrategyTest extends WsdlTestHelper { public function setUp() @@ -30,7 +24,8 @@ public function setUp() public function testNestingObjectsDeepMakesNoSenseThrowingException() { - $this->setExpectedException('Zend\Soap\Exception\InvalidArgumentException', + $this->setExpectedException( + 'Zend\Soap\Exception\InvalidArgumentException', 'ArrayOfTypeComplex cannot return nested ArrayOfObject deeper than one level' ); $this->wsdl->addComplexType('\ZendTest\Soap\TestAsset\ComplexTest[][]'); @@ -38,7 +33,8 @@ public function testNestingObjectsDeepMakesNoSenseThrowingException() public function testAddComplexTypeOfNonExistingClassThrowsException() { - $this->setExpectedException('Zend\Soap\Exception\InvalidArgumentException', + $this->setExpectedException( + 'Zend\Soap\Exception\InvalidArgumentException', 'Cannot add a complex type \ZendTest\Soap\TestAsset\UnknownClass that is not an object or where class' ); $this->wsdl->addComplexType('\ZendTest\Soap\TestAsset\UnknownClass[]'); @@ -65,16 +61,22 @@ public function testArrayOfSimpleObject() '//wsdl:types/*/xsd:complexType[@name="ArrayOfComplexTest"]/xsd:complexContent/xsd:restriction' ); $this->assertEquals(1, $nodes->length, 'Unable to find complex type array definition in wsdl.'); - $this->assertEquals('soap-enc:Array', $nodes->item(0)->getAttribute('base'), + $this->assertEquals( + 'soap-enc:Array', + $nodes->item(0)->getAttribute('base'), 'Invalid base encoding in complex type.' ); $nodes = $this->xpath->query('xsd:attribute', $nodes->item(0)); - $this->assertEquals('soap-enc:arrayType', $nodes->item(0)->getAttribute('ref'), + $this->assertEquals( + 'soap-enc:arrayType', + $nodes->item(0)->getAttribute('ref'), 'Invalid attribute reference value in complex type.' ); - $this->assertEquals('tns:ComplexTest[]', $nodes->item(0)->getAttributeNS(Wsdl::WSDL_NS_URI, 'arrayType'), + $this->assertEquals( + 'tns:ComplexTest[]', + $nodes->item(0)->getAttributeNS(Wsdl::WSDL_NS_URI, 'arrayType'), 'Invalid array type reference.' ); @@ -107,10 +109,14 @@ public function testArrayOfComplexObjects() 'array' => 'soap-enc:Array' ] as $name => $type) { $node = $this->xpath->query('xsd:element[@name="'.$name.'"]', $nodes->item(0)); - $this->assertEquals($name, $node->item(0)->getAttribute('name'), + $this->assertEquals( + $name, + $node->item(0)->getAttribute('name'), 'Invalid name attribute value in complex object definition' ); - $this->assertEquals($type, $node->item(0)->getAttribute('type'), + $this->assertEquals( + $type, + $node->item(0)->getAttribute('type'), 'Invalid type name in complex object definition' ); } @@ -120,16 +126,21 @@ public function testArrayOfComplexObjects() '//wsdl:types/*/xsd:complexType[@name="ArrayOfComplexObjectStructure"]/xsd:complexContent/xsd:restriction' ); $this->assertEquals(1, $nodes->length, 'Unable to find complex type array definition in wsdl.'); - $this->assertEquals('soap-enc:Array', $nodes->item(0)->getAttribute('base'), + $this->assertEquals( + 'soap-enc:Array', + $nodes->item(0)->getAttribute('base'), 'Invalid base encoding in complex type.' ); $nodes = $this->xpath->query('xsd:attribute', $nodes->item(0)); - $this->assertEquals('soap-enc:arrayType', $nodes->item(0)->getAttribute('ref'), + $this->assertEquals( + 'soap-enc:arrayType', + $nodes->item(0)->getAttribute('ref'), 'Invalid attribute reference value in complex type.' ); - $this->assertEquals('tns:ComplexObjectStructure[]', + $this->assertEquals( + 'tns:ComplexObjectStructure[]', $nodes->item(0)->getAttributeNS(Wsdl::WSDL_NS_URI, 'arrayType'), 'Invalid array type reference.' ); @@ -156,13 +167,19 @@ public function testArrayOfObjectWithObject() ); $this->assertEquals(1, $nodes->length, 'Unable to find complex object in wsdl.'); - $this->assertEquals('object', $nodes->item(0)->getAttribute('name'), + $this->assertEquals( + 'object', + $nodes->item(0)->getAttribute('name'), 'Invalid attribute name' ); - $this->assertEquals('tns:ComplexTest', $nodes->item(0)->getAttribute('type'), + $this->assertEquals( + 'tns:ComplexTest', + $nodes->item(0)->getAttribute('type'), 'Invalid type name' ); - $this->assertEquals('true', $nodes->item(0)->getAttribute('nillable'), + $this->assertEquals( + 'true', + $nodes->item(0)->getAttribute('nillable'), 'Invalid nillable attribute value' ); @@ -172,16 +189,21 @@ public function testArrayOfObjectWithObject() .'xsd:complexContent/xsd:restriction' ); $this->assertEquals(1, $nodes->length, 'Unable to find complex type array definition in wsdl.'); - $this->assertEquals('soap-enc:Array', $nodes->item(0)->getAttribute('base'), + $this->assertEquals( + 'soap-enc:Array', + $nodes->item(0)->getAttribute('base'), 'Invalid base encoding in complex type.' ); $nodes = $this->xpath->query('xsd:attribute', $nodes->item(0)); - $this->assertEquals('soap-enc:arrayType', $nodes->item(0)->getAttribute('ref'), + $this->assertEquals( + 'soap-enc:arrayType', + $nodes->item(0)->getAttribute('ref'), 'Invalid attribute reference value in complex type.' ); - $this->assertEquals('tns:ComplexObjectWithObjectStructure[]', + $this->assertEquals( + 'tns:ComplexObjectWithObjectStructure[]', $nodes->item(0)->getAttributeNS(Wsdl::WSDL_NS_URI, 'arrayType'), 'Invalid array type reference.' ); @@ -197,11 +219,14 @@ public function testAddingTypesMultipleTimesIsSavedOnlyOnce() $this->wsdl->addComplexType('\ZendTest\Soap\TestAsset\ComplexObjectWithObjectStructure[]'); $this->wsdl->addComplexType('\ZendTest\Soap\TestAsset\ComplexObjectWithObjectStructure[]'); - // this xpath is proper version of simpler: //*[wsdl:arrayType="tns:ComplexObjectWithObjectStructure[]"] - namespaces in attributes and xpath + // this xpath is proper version of simpler: + // //*[wsdl:arrayType="tns:ComplexObjectWithObjectStructure[]"] + // (namespaces in attributes and xpath) $nodes = $this->xpath->query('//*[@*[namespace-uri()="'.Wsdl::WSDL_NS_URI - .'" and local-name()="arrayType"]="tns:ComplexObjectWithObjectStructure[]"]' - ); - $this->assertEquals(1, $nodes->length, + .'" and local-name()="arrayType"]="tns:ComplexObjectWithObjectStructure[]"]'); + $this->assertEquals( + 1, + $nodes->length, 'Invalid array of complex type array type reference detected' ); @@ -224,11 +249,14 @@ public function testAddingSingularThenArrayTypeIsRecognizedCorretly() $this->wsdl->addComplexType('\ZendTest\Soap\TestAsset\ComplexObjectWithObjectStructure'); $this->wsdl->addComplexType('\ZendTest\Soap\TestAsset\ComplexObjectWithObjectStructure[]'); - // this xpath is proper version of simpler: //*[wsdl:arrayType="tns:ComplexObjectWithObjectStructure[]"] - namespaces in attributes and xpath + // this xpath is proper version of simpler: + // //*[wsdl:arrayType="tns:ComplexObjectWithObjectStructure[]"] + // (namespaces in attributes and xpath) $nodes = $this->xpath->query('//*[@*[namespace-uri()="'.Wsdl::WSDL_NS_URI. - '" and local-name()="arrayType"]="tns:ComplexObjectWithObjectStructure[]"]' - ); - $this->assertEquals(1, $nodes->length, + '" and local-name()="arrayType"]="tns:ComplexObjectWithObjectStructure[]"]'); + $this->assertEquals( + 1, + $nodes->length, 'Invalid array of complex type array type reference detected' ); @@ -260,13 +288,19 @@ public function testArrayOfComplexNestedObjectsIsCoveredByStrategyAndAddsAllType 'foo' => 'xsd:string', ] as $name => $type) { $node = $this->xpath->query('xsd:element[@name="'.$name.'"]', $nodes->item(0)); - $this->assertEquals($name, $node->item(0)->getAttribute('name'), + $this->assertEquals( + $name, + $node->item(0)->getAttribute('name'), 'Invalid name attribute value in complex object definition' ); - $this->assertEquals($type, $node->item(0)->getAttribute('type'), + $this->assertEquals( + $type, + $node->item(0)->getAttribute('type'), 'Invalid type name in complex object definition' ); - $this->assertEquals('true', $node->item(0)->getAttribute('nillable'), + $this->assertEquals( + 'true', + $node->item(0)->getAttribute('nillable'), 'Invalid nillable attribute value' ); } @@ -277,31 +311,41 @@ public function testArrayOfComplexNestedObjectsIsCoveredByStrategyAndAddsAllType ); $this->assertEquals(1, $nodes->length, 'Unable to find complex object in wsdl.'); - $this->assertEquals('baz', - $nodes->item(0)->getAttribute('name'), 'Invalid attribute name' + $this->assertEquals( + 'baz', + $nodes->item(0)->getAttribute('name'), + 'Invalid attribute name' ); - $this->assertEquals('tns:ArrayOfComplexTypeB', - $nodes->item(0)->getAttribute('type'), 'Invalid type name' + $this->assertEquals( + 'tns:ArrayOfComplexTypeB', + $nodes->item(0)->getAttribute('type'), + 'Invalid type name' ); // array of elements $nodes = $this->xpath->query( '//wsdl:types/*/xsd:complexType[@name="ArrayOfComplexTypeB"]/xsd:complexContent/xsd:restriction' ); - $this->assertEquals(1, $nodes->length, + $this->assertEquals( + 1, + $nodes->length, 'Unable to find complex type array definition in wsdl.' ); - $this->assertEquals('soap-enc:Array', $nodes->item(0)->getAttribute('base'), + $this->assertEquals( + 'soap-enc:Array', + $nodes->item(0)->getAttribute('base'), 'Invalid base encoding in complex type.' ); $nodes = $this->xpath->query('xsd:attribute', $nodes->item(0)); - $this->assertEquals('soap-enc:arrayType', + $this->assertEquals( + 'soap-enc:arrayType', $nodes->item(0)->getAttribute('ref'), 'Invalid attribute reference value in complex type.' ); - $this->assertEquals('tns:ComplexTypeB[]', + $this->assertEquals( + 'tns:ComplexTypeB[]', $nodes->item(0)->getAttributeNS(Wsdl::WSDL_NS_URI, 'arrayType'), 'Invalid array type reference.' ); diff --git a/test/Wsdl/ArrayOfTypeSequenceStrategyTest.php b/test/Wsdl/ArrayOfTypeSequenceStrategyTest.php index f8eb904e..d1dcdfa9 100644 --- a/test/Wsdl/ArrayOfTypeSequenceStrategyTest.php +++ b/test/Wsdl/ArrayOfTypeSequenceStrategyTest.php @@ -11,12 +11,6 @@ use ZendTest\Soap\WsdlTestHelper; -require_once __DIR__ . '/../TestAsset/commontypes.php'; - -/** - * @group Zend_Soap - * @group Zend_Soap_Wsdl - */ class ArrayOfTypeSequenceStrategyTest extends WsdlTestHelper { public function setUp() @@ -44,16 +38,24 @@ public function testFunctionReturningSimpleArrayOfBasicTypes($type, $arrayTypeNa $nodes = $this->xpath->query('xsd:sequence/xsd:element', $nodes->item(0)); $this->assertEquals(1, $nodes->length, 'Missing complex type element declaration'); - $this->assertEquals('item', $nodes->item(0)->getAttribute('name'), + $this->assertEquals( + 'item', + $nodes->item(0)->getAttribute('name'), 'Wrong complex type element name attribute' ); - $this->assertEquals('xsd:'.$type, $nodes->item(0)->getAttribute('type'), + $this->assertEquals( + 'xsd:'.$type, + $nodes->item(0)->getAttribute('type'), 'Wrong complex type type attribute value' ); - $this->assertEquals('0', $nodes->item(0)->getAttribute('minOccurs'), + $this->assertEquals( + '0', + $nodes->item(0)->getAttribute('minOccurs'), 'Wrong complex type minOccurs attribute value' ); - $this->assertEquals('unbounded', $nodes->item(0)->getAttribute('maxOccurs'), + $this->assertEquals( + 'unbounded', + $nodes->item(0)->getAttribute('maxOccurs'), 'Wrong complex type maxOccurs attribute value' ); @@ -89,16 +91,24 @@ public function testNestedTypesDefinitions($stringDefinition, $definedTypeName, $nodes = $this->xpath->query('xsd:sequence/xsd:element', $nodes->item(0)); $this->assertEquals(1, $nodes->length, 'Invalid element in first level of nested element definition'); - $this->assertEquals('item', $nodes->item(0)->getAttribute('name'), + $this->assertEquals( + 'item', + $nodes->item(0)->getAttribute('name'), 'Wrong complex type element name attribute' ); - $this->assertEquals('0', $nodes->item(0)->getAttribute('minOccurs'), + $this->assertEquals( + '0', + $nodes->item(0)->getAttribute('minOccurs'), 'Wrong complex type minOccurs attribute value' ); - $this->assertEquals('unbounded', $nodes->item(0)->getAttribute('maxOccurs'), + $this->assertEquals( + 'unbounded', + $nodes->item(0)->getAttribute('maxOccurs'), 'Wrong complex type maxOccurs attribute value' ); - $this->assertEquals($typeName, $nodes->item(0)->getAttribute('type'), + $this->assertEquals( + $typeName, + $nodes->item(0)->getAttribute('type'), 'Wrong complex type type attribute value' ); } @@ -185,10 +195,14 @@ public function testAddComplexTypeArrayOfObject() $this->assertEquals(1, $nodes->length, 'Missing complex type element declaration'); - $this->assertEquals('baz', $nodes->item(0)->getAttribute('name'), + $this->assertEquals( + 'baz', + $nodes->item(0)->getAttribute('name'), 'Wrong complex type element name attribute' ); - $this->assertEquals('tns:ArrayOfComplexTypeB', $nodes->item(0)->getAttribute('type'), + $this->assertEquals( + 'tns:ArrayOfComplexTypeB', + $nodes->item(0)->getAttribute('type'), 'Wrong complex type type attribute value' ); @@ -203,13 +217,19 @@ public function testAddComplexTypeArrayOfObject() ] as $name => $type) { $node = $this->xpath->query('xsd:all/xsd:element[@name="'.$name.'"]', $nodes->item(0)); - $this->assertEquals($name, $node->item(0)->getAttribute('name'), + $this->assertEquals( + $name, + $node->item(0)->getAttribute('name'), 'Invalid name attribute value in complex object definition' ); - $this->assertEquals($type, $node->item(0)->getAttribute('type'), + $this->assertEquals( + $type, + $node->item(0)->getAttribute('type'), 'Invalid type name in complex object definition' ); - $this->assertEquals('true', $node->item(0)->getAttribute('nillable'), + $this->assertEquals( + 'true', + $node->item(0)->getAttribute('nillable'), 'Invalid nillable attribute value' ); } @@ -221,25 +241,33 @@ public function testAddComplexTypeArrayOfObject() 'ArrayOfComplexTypeA' => 'ComplexTypeA' ] as $arrayTypeName => $typeName) { $nodes = $this->xpath->query( - '//wsdl:types/xsd:schema/xsd:complexType[@name="'.$arrayTypeName.'"]' - ); + '//wsdl:types/xsd:schema/xsd:complexType[@name="'.$arrayTypeName.'"]' + ); $this->assertEquals(1, $nodes->length, 'Missing complex type definition.'); $nodes = $this->xpath->query('xsd:sequence/xsd:element', $nodes->item(0)); $this->assertEquals(1, $nodes->length, 'Missing complex type element declaration'); - $this->assertEquals('item', $nodes->item(0)->getAttribute('name'), - 'Wrong complex type element name attribute' - ); - $this->assertEquals('tns:'.$typeName, $nodes->item(0)->getAttribute('type'), - 'Wrong complex type type attribute value' - ); - $this->assertEquals('0', $nodes->item(0)->getAttribute('minOccurs'), - 'Wrong complex type minOccurs attribute value' - ); - $this->assertEquals('unbounded', $nodes->item(0)->getAttribute('maxOccurs'), - 'Wrong complex type maxOccurs attribute value' - ); + $this->assertEquals( + 'item', + $nodes->item(0)->getAttribute('name'), + 'Wrong complex type element name attribute' + ); + $this->assertEquals( + 'tns:'.$typeName, + $nodes->item(0)->getAttribute('type'), + 'Wrong complex type type attribute value' + ); + $this->assertEquals( + '0', + $nodes->item(0)->getAttribute('minOccurs'), + 'Wrong complex type minOccurs attribute value' + ); + $this->assertEquals( + 'unbounded', + $nodes->item(0)->getAttribute('maxOccurs'), + 'Wrong complex type maxOccurs attribute value' + ); } $this->testDocumentNodes(); diff --git a/test/Wsdl/CompositeStrategyTest.php b/test/Wsdl/CompositeStrategyTest.php index 8101af3e..685ec7cf 100644 --- a/test/Wsdl/CompositeStrategyTest.php +++ b/test/Wsdl/CompositeStrategyTest.php @@ -44,7 +44,8 @@ public function testConstructorTypeMapSyntax() { $typeMap = ['Book' => '\Zend\Soap\Wsdl\ComplexTypeStrategy\ArrayOfTypeComplex']; - $strategy = new ComplexTypeStrategy\Composite($typeMap, + $strategy = new ComplexTypeStrategy\Composite( + $typeMap, new ArrayOfTypeSequence ); @@ -59,7 +60,8 @@ public function testCompositeThrowsExceptionOnInvalidType() { $strategy = new ComplexTypeStrategy\Composite(); - $this->setExpectedException('Zend\Soap\Exception\InvalidArgumentException', + $this->setExpectedException( + 'Zend\Soap\Exception\InvalidArgumentException', 'Invalid type given to Composite Type Map' ); $strategy->connectTypeToStrategy([], 'strategy'); @@ -70,7 +72,8 @@ public function testCompositeThrowsExceptionOnInvalidStrategy() $strategy = new ComplexTypeStrategy\Composite([], 'invalid'); $strategy->connectTypeToStrategy('Book', 'strategy'); - $this->setExpectedException('Zend\Soap\Exception\InvalidArgumentException', + $this->setExpectedException( + 'Zend\Soap\Exception\InvalidArgumentException', 'Strategy for Complex Type "Book" is not a valid strategy' ); $strategy->getStrategyOfType('Book'); @@ -81,7 +84,8 @@ public function testCompositeThrowsExceptionOnInvalidStrategyPart2() $strategy = new ComplexTypeStrategy\Composite([], 'invalid'); $strategy->connectTypeToStrategy('Book', 'strategy'); - $this->setExpectedException('Zend\Soap\Exception\InvalidArgumentException', + $this->setExpectedException( + 'Zend\Soap\Exception\InvalidArgumentException', 'Default Strategy for Complex Types is not a valid strategy object' ); $strategy->getStrategyOfType('Anything'); @@ -90,16 +94,18 @@ public function testCompositeThrowsExceptionOnInvalidStrategyPart2() public function testCompositeDelegatesAddingComplexTypesToSubStrategies() { $this->strategy = new ComplexTypeStrategy\Composite([], new AnyType); - $this->strategy->connectTypeToStrategy('\ZendTest\Soap\TestAsset\Book', + $this->strategy->connectTypeToStrategy( + '\ZendTest\Soap\TestAsset\Book', new ArrayOfTypeComplex ); - $this->strategy->connectTypeToStrategy('\ZendTest\Soap\TestAsset\Cookie', + $this->strategy->connectTypeToStrategy( + '\ZendTest\Soap\TestAsset\Cookie', new DefaultComplexType ); parent::setUp(); - $this->assertEquals('tns:Book', $this->strategy->addComplexType('\ZendTest\Soap\TestAsset\Book')); + $this->assertEquals('tns:Book', $this->strategy->addComplexType('\ZendTest\Soap\TestAsset\Book')); $this->assertEquals('tns:Cookie', $this->strategy->addComplexType('\ZendTest\Soap\TestAsset\Cookie')); $this->assertEquals('xsd:anyType', $this->strategy->addComplexType('\ZendTest\Soap\TestAsset\Anything')); diff --git a/test/Wsdl/DefaultComplexTypeTest.php b/test/Wsdl/DefaultComplexTypeTest.php index 77c5ed85..202b9055 100644 --- a/test/Wsdl/DefaultComplexTypeTest.php +++ b/test/Wsdl/DefaultComplexTypeTest.php @@ -13,8 +13,6 @@ use ZendTest\Soap\TestAsset\PublicPrivateProtected; use ZendTest\Soap\WsdlTestHelper; -require_once __DIR__ . '/../TestAsset/commontypes.php'; - /** * @covers \Zend\Soap\Wsdl\ComplexTypeStrategy\DefaultComplexType */ diff --git a/test/WsdlTest.php b/test/WsdlTest.php index ec1e04fb..488c67b8 100644 --- a/test/WsdlTest.php +++ b/test/WsdlTest.php @@ -22,19 +22,19 @@ class WsdlTest extends WsdlTestHelper { public function testConstructor() { - $this->assertEquals(Wsdl::WSDL_NS_URI, $this->dom->lookupNamespaceUri(null)); - $this->assertEquals(Wsdl::SOAP_11_NS_URI, $this->dom->lookupNamespaceUri('soap')); - $this->assertEquals(Wsdl::SOAP_12_NS_URI, $this->dom->lookupNamespaceUri('soap12')); - $this->assertEquals($this->defaultServiceUri, $this->dom->lookupNamespaceUri('tns')); - $this->assertEquals(Wsdl::SOAP_11_NS_URI, $this->dom->lookupNamespaceUri('soap')); - $this->assertEquals(Wsdl::XSD_NS_URI, $this->dom->lookupNamespaceUri('xsd')); - $this->assertEquals(Wsdl::SOAP_ENC_URI, $this->dom->lookupNamespaceUri('soap-enc')); - $this->assertEquals(Wsdl::WSDL_NS_URI, $this->dom->lookupNamespaceUri('wsdl')); + $this->assertEquals(Wsdl::WSDL_NS_URI, $this->dom->lookupNamespaceUri(null)); + $this->assertEquals(Wsdl::SOAP_11_NS_URI, $this->dom->lookupNamespaceUri('soap')); + $this->assertEquals(Wsdl::SOAP_12_NS_URI, $this->dom->lookupNamespaceUri('soap12')); + $this->assertEquals($this->defaultServiceUri, $this->dom->lookupNamespaceUri('tns')); + $this->assertEquals(Wsdl::SOAP_11_NS_URI, $this->dom->lookupNamespaceUri('soap')); + $this->assertEquals(Wsdl::XSD_NS_URI, $this->dom->lookupNamespaceUri('xsd')); + $this->assertEquals(Wsdl::SOAP_ENC_URI, $this->dom->lookupNamespaceUri('soap-enc')); + $this->assertEquals(Wsdl::WSDL_NS_URI, $this->dom->lookupNamespaceUri('wsdl')); - $this->assertEquals(Wsdl::WSDL_NS_URI, $this->dom->documentElement->namespaceURI); + $this->assertEquals(Wsdl::WSDL_NS_URI, $this->dom->documentElement->namespaceURI); - $this->assertEquals($this->defaultServiceName, $this->dom->documentElement->getAttribute('name')); - $this->assertEquals($this->defaultServiceUri, $this->dom->documentElement->getAttribute('targetNamespace')); + $this->assertEquals($this->defaultServiceName, $this->dom->documentElement->getAttribute('name')); + $this->assertEquals($this->defaultServiceUri, $this->dom->documentElement->getAttribute('targetNamespace')); $this->testDocumentNodes(); } @@ -63,8 +63,10 @@ public function testSetUriChangesDomDocumentWsdlStructureTnsAndTargetNamespaceAt * * @param string $uri */ - public function testSetUriWithZendUriChangesDomDocumentWsdlStructureTnsAndTargetNamespaceAttributes($uri, $expectedUri) - { + public function testSetUriWithZendUriChangesDomDocumentWsdlStructureTnsAndTargetNamespaceAttributes( + $uri, + $expectedUri + ) { $this->wsdl->setUri(new Uri($uri)); $this->testDocumentNodes(); @@ -267,8 +269,8 @@ public function testAddBinding() $this->fail('Missing binding node in definitions node.'.$bindingNodes->length); } - $this->assertEquals('MyServiceBinding', $bindingNodes->item(0)->getAttribute('name')); - $this->assertEquals('myPortType', $bindingNodes->item(0)->getAttribute('type')); + $this->assertEquals('MyServiceBinding', $bindingNodes->item(0)->getAttribute('name')); + $this->assertEquals('myPortType', $bindingNodes->item(0)->getAttribute('type')); } /** @@ -283,11 +285,17 @@ public function testAddBinding() * @param null $faultEncoding * @param null $faultName */ - public function testAddBindingOperation($operationName, - $input = null, $inputEncoding = null, - $output = null, $outputEncoding = null, - $fault = null, $faultEncoding = null, $faultName = null) - { + public function testAddBindingOperation( + $operationName, + $input = null, + $inputEncoding = null, + $output = null, + $outputEncoding = null, + $fault = null, + $faultEncoding = null, + $faultName = null + ) { + $binding = $this->wsdl->addBinding('MyServiceBinding', 'myPortType'); $inputArray = []; @@ -305,7 +313,8 @@ public function testAddBindingOperation($operationName, $faultArray = ['use' => $fault, 'encodingStyle' => $faultEncoding, 'name'=>$faultName]; } - $this->wsdl->addBindingOperation($binding, + $this->wsdl->addBindingOperation( + $binding, $operationName, $inputArray, $outputArray, @@ -318,8 +327,8 @@ public function testAddBindingOperation($operationName, $this->assertGreaterThan(0, $bindingNodes->length, 'Missing binding node in definition.'); - $this->assertEquals('MyServiceBinding', $bindingNodes->item(0)->getAttribute('name')); - $this->assertEquals('myPortType', $bindingNodes->item(0)->getAttribute('type')); + $this->assertEquals('MyServiceBinding', $bindingNodes->item(0)->getAttribute('name')); + $this->assertEquals('myPortType', $bindingNodes->item(0)->getAttribute('type')); $operationNodes = $this->xpath->query('wsdl:operation[@name="'.$operationName.'"]', $bindingNodes->item(0)); $this->assertEquals(1, $operationNodes->length, 'Missing operation node in definition.'); @@ -339,8 +348,11 @@ public function testAddBindingOperation($operationName, $this->assertGreaterThan(0, $nodes->length, 'Missing operation body.'); foreach ($ar as $key => $val) { - $this->assertEquals($ar[$key], $nodes->item(0)->getAttribute($key), - 'Bad attribute in operation definition: '.$key); + $this->assertEquals( + $ar[$key], + $nodes->item(0)->getAttribute($key), + 'Bad attribute in operation definition: '.$key + ); } } } @@ -458,7 +470,10 @@ public function testAddBindingOperationWithAmpersandInUrl($actualUrl, $expectedU ['name' => 'MyFault', 'use' => 'encoded', 'encodingStyle' => $actualUrl] ); - $nodes = $this->xpath->query('//wsdl:binding[@type="myPortType" and @name="MyServiceBinding"]/wsdl:operation[@name="operation1"]/wsdl:input/soap:body'); + $nodes = $this->xpath->query( + '//wsdl:binding[@type="myPortType" ' + . 'and @name="MyServiceBinding"]/wsdl:operation[@name="operation1"]/wsdl:input/soap:body' + ); $this->assertGreaterThanOrEqual(1, $nodes->length); $this->assertEquals($expectedUrl, $nodes->item(0)->getAttribute('encodingStyle')); @@ -605,31 +620,41 @@ public function checkXMLContent($content) public function testGetType() { - $this->assertEquals('xsd:string', $this->wsdl->getType('string'), 'xsd:string detection failed.'); - $this->assertEquals('xsd:string', $this->wsdl->getType('str'), 'xsd:string detection failed.'); - $this->assertEquals('xsd:int', $this->wsdl->getType('int'), 'xsd:int detection failed.'); - $this->assertEquals('xsd:int', $this->wsdl->getType('integer'), 'xsd:int detection failed.'); - $this->assertEquals('xsd:float', $this->wsdl->getType('float'), 'xsd:float detection failed.'); - $this->assertEquals('xsd:double', $this->wsdl->getType('double'), 'xsd:double detection failed.'); - $this->assertEquals('xsd:boolean', $this->wsdl->getType('boolean'), 'xsd:boolean detection failed.'); - $this->assertEquals('xsd:boolean', $this->wsdl->getType('bool'), 'xsd:boolean detection failed.'); - $this->assertEquals('soap-enc:Array', $this->wsdl->getType('array'), 'soap-enc:Array detection failed.'); - $this->assertEquals('xsd:struct', $this->wsdl->getType('object'), 'xsd:struct detection failed.'); - $this->assertEquals('xsd:anyType', $this->wsdl->getType('mixed'), 'xsd:anyType detection failed.'); - $this->assertEquals('', $this->wsdl->getType('void'), 'void detection failed.'); + $this->assertEquals('xsd:string', $this->wsdl->getType('string'), 'xsd:string detection failed.'); + $this->assertEquals('xsd:string', $this->wsdl->getType('str'), 'xsd:string detection failed.'); + $this->assertEquals('xsd:int', $this->wsdl->getType('int'), 'xsd:int detection failed.'); + $this->assertEquals('xsd:int', $this->wsdl->getType('integer'), 'xsd:int detection failed.'); + $this->assertEquals('xsd:float', $this->wsdl->getType('float'), 'xsd:float detection failed.'); + $this->assertEquals('xsd:double', $this->wsdl->getType('double'), 'xsd:double detection failed.'); + $this->assertEquals('xsd:boolean', $this->wsdl->getType('boolean'), 'xsd:boolean detection failed.'); + $this->assertEquals('xsd:boolean', $this->wsdl->getType('bool'), 'xsd:boolean detection failed.'); + $this->assertEquals('soap-enc:Array', $this->wsdl->getType('array'), 'soap-enc:Array detection failed.'); + $this->assertEquals('xsd:struct', $this->wsdl->getType('object'), 'xsd:struct detection failed.'); + $this->assertEquals('xsd:anyType', $this->wsdl->getType('mixed'), 'xsd:anyType detection failed.'); + $this->assertEquals('', $this->wsdl->getType('void'), 'void detection failed.'); } public function testGetComplexTypeBasedOnStrategiesBackwardsCompabilityBoolean() { $this->assertEquals('tns:WsdlTestClass', $this->wsdl->getType('\ZendTest\Soap\TestAsset\WsdlTestClass')); - $this->assertInstanceOf('Zend\Soap\Wsdl\ComplexTypeStrategy\DefaultComplexType', $this->wsdl->getComplexTypeStrategy()); + $this->assertInstanceOf( + 'Zend\Soap\Wsdl\ComplexTypeStrategy\DefaultComplexType', + $this->wsdl->getComplexTypeStrategy() + ); } public function testGetComplexTypeBasedOnStrategiesStringNames() { - $this->wsdl = new Wsdl($this->defaultServiceName, 'http://localhost/MyService.php', new Wsdl\ComplexTypeStrategy\DefaultComplexType); + $this->wsdl = new Wsdl( + $this->defaultServiceName, + 'http://localhost/MyService.php', + new Wsdl\ComplexTypeStrategy\DefaultComplexType + ); $this->assertEquals('tns:WsdlTestClass', $this->wsdl->getType('\ZendTest\Soap\TestAsset\WsdlTestClass')); - $this->assertInstanceOf('Zend\Soap\Wsdl\ComplexTypeStrategy\DefaultComplexType', $this->wsdl->getComplexTypeStrategy()); + $this->assertInstanceOf( + 'Zend\Soap\Wsdl\ComplexTypeStrategy\DefaultComplexType', + $this->wsdl->getComplexTypeStrategy() + ); $wsdl2 = new Wsdl($this->defaultServiceName, $this->defaultServiceUri, new Wsdl\ComplexTypeStrategy\AnyType); $this->assertEquals('xsd:anyType', $wsdl2->getType('\ZendTest\Soap\TestAsset\WsdlTestClass')); @@ -756,14 +781,14 @@ public function dataProviderForTranslateType() */ public function testCaseOfDocBlockParamsDosNotMatterForSoapTypeDetectionZf3910() { - $this->assertEquals("xsd:string", $this->wsdl->getType("StrIng")); - $this->assertEquals("xsd:string", $this->wsdl->getType("sTr")); - $this->assertEquals("xsd:int", $this->wsdl->getType("iNt")); - $this->assertEquals("xsd:int", $this->wsdl->getType("INTEGER")); - $this->assertEquals("xsd:float", $this->wsdl->getType("FLOAT")); - $this->assertEquals("xsd:double", $this->wsdl->getType("douBLE")); + $this->assertEquals("xsd:string", $this->wsdl->getType("StrIng")); + $this->assertEquals("xsd:string", $this->wsdl->getType("sTr")); + $this->assertEquals("xsd:int", $this->wsdl->getType("iNt")); + $this->assertEquals("xsd:int", $this->wsdl->getType("INTEGER")); + $this->assertEquals("xsd:float", $this->wsdl->getType("FLOAT")); + $this->assertEquals("xsd:double", $this->wsdl->getType("douBLE")); - $this->assertEquals("xsd:long", $this->wsdl->getType("long")); + $this->assertEquals("xsd:long", $this->wsdl->getType("long")); } /** @@ -781,10 +806,10 @@ public function testMultipleSequenceDefinitionsOfSameTypeWillBeRecognizedOnceByS $this->testDocumentNodes(); $nodes = $this->xpath->query('//wsdl:types/xsd:schema/xsd:complexType[@name="ArrayOfString"]'); - $this->assertEquals(1, $nodes->length, "ArrayOfString should appear only once."); + $this->assertEquals(1, $nodes->length, "ArrayOfString should appear only once."); $nodes = $this->xpath->query('//wsdl:types/xsd:schema/xsd:complexType[@name="ArrayOfInt"]'); - $this->assertEquals(1, $nodes->length, "ArrayOfInt should appear only once."); + $this->assertEquals(1, $nodes->length, "ArrayOfInt should appear only once."); } public function testClassMap() @@ -818,7 +843,9 @@ public function testAddElement() $this->assertEquals('tns:'.$element['name'], $newElementName); - $nodes = $this->xpath->query('//wsdl:types/xsd:schema/xsd:element[@name="'.$element['name'].'"]/xsd:complexType'); + $nodes = $this->xpath->query( + '//wsdl:types/xsd:schema/xsd:element[@name="' . $element['name'] . '"]/xsd:complexType' + ); $this->assertEquals(1, $nodes->length); @@ -827,7 +854,10 @@ public function testAddElement() $n = 0; foreach ($element['sequence'] as $elementDefinition) { $n++; - $elementNode = $this->xpath->query('xsd:element[@name="'.$elementDefinition['name'].'"]', $nodes->item(0)->firstChild); + $elementNode = $this->xpath->query( + 'xsd:element[@name="' . $elementDefinition['name'] . '"]', + $nodes->item(0)->firstChild + ); $this->assertEquals($elementDefinition['type'], $elementNode->item(0)->getAttribute('type')); } diff --git a/test/WsdlTestHelper.php b/test/WsdlTestHelper.php index 111c4dfe..0ee2ae20 100644 --- a/test/WsdlTestHelper.php +++ b/test/WsdlTestHelper.php @@ -79,12 +79,12 @@ public function registerNamespaces($obj, $documentNamespace = null) $this->xpath = new \DOMXPath($obj); $this->xpath->registerNamespace('unittest', Wsdl::WSDL_NS_URI); - $this->xpath->registerNamespace('tns', $documentNamespace); - $this->xpath->registerNamespace('soap', Wsdl::SOAP_11_NS_URI); - $this->xpath->registerNamespace('soap12', Wsdl::SOAP_12_NS_URI); - $this->xpath->registerNamespace('xsd', Wsdl::XSD_NS_URI); + $this->xpath->registerNamespace('tns', $documentNamespace); + $this->xpath->registerNamespace('soap', Wsdl::SOAP_11_NS_URI); + $this->xpath->registerNamespace('soap12', Wsdl::SOAP_12_NS_URI); + $this->xpath->registerNamespace('xsd', Wsdl::XSD_NS_URI); $this->xpath->registerNamespace('soap-enc', Wsdl::SOAP_ENC_URI); - $this->xpath->registerNamespace('wsdl', Wsdl::WSDL_NS_URI); + $this->xpath->registerNamespace('wsdl', Wsdl::WSDL_NS_URI); return $obj; } @@ -102,10 +102,12 @@ public function testDocumentNodes($element = null) $element = $this->wsdl->toDomDocument()->documentElement; } - /** @var $node \DOMElement */ foreach ($element->childNodes as $node) { if (in_array($node->nodeType, [XML_ELEMENT_NODE])) { - $this->assertNotEmpty($node->namespaceURI, 'Document element: ' . $node->nodeName . ' has no valid namespace. Line: ' . $node->getLineNo()); + $this->assertNotEmpty( + $node->namespaceURI, + 'Document element: ' . $node->nodeName . ' has no valid namespace. Line: ' . $node->getLineNo() + ); $this->testDocumentNodes($node); } } diff --git a/test/_files/commontypes.php b/test/_files/commontypes.php index 0ada88c0..cdf07e19 100644 --- a/test/_files/commontypes.php +++ b/test/_files/commontypes.php @@ -1,4 +1,4 @@ - 'bar', 'baz' => true, 1 => false, 'bat' => 123); + return ['foo' => 'bar', 'baz' => true, 1 => false, 'bat' => 123]; } /** @@ -85,7 +85,7 @@ function Zend_Soap_AutoDiscover_TestFunc7() */ function Zend_Soap_AutoDiscover_TestFunc8() { - $return = (object) array('foo' => 'bar', 'baz' => true, 'bat' => 123, 'qux' => false); + $return = (object) ['foo' => 'bar', 'baz' => true, 'bat' => 123, 'qux' => false]; return $return; } @@ -111,7 +111,7 @@ class Zend_Soap_AutoDiscover_TestFixingMultiplePrototypes * @param integer $d * @return integer */ - public function testFunc($a=100, $b=200, $d=300) + public function testFunc($a = 100, $b = 200, $d = 300) { } @@ -193,10 +193,10 @@ public function add(Zend_Soap_AutoDiscoverTestClass1 $test) */ public function fetchAll() { - return array( + return [ new Zend_Soap_AutoDiscoverTestClass1(), new Zend_Soap_AutoDiscoverTestClass1(), - ); + ]; } /** @@ -225,7 +225,7 @@ class Zend_Soap_Wsdl_ComplexTypeA /** * @var Zend_Soap_Wsdl_ComplexTypeB[] */ - public $baz = array(); + public $baz = []; } class Zend_Soap_Wsdl_ComplexTest @@ -256,7 +256,7 @@ class Zend_Soap_Wsdl_ComplexObjectStructure /** * @var array */ - public $array = array(1, 2, 3); + public $array = [1, 2, 3]; } class Zend_Soap_Wsdl_ComplexObjectWithObjectStructure @@ -345,7 +345,9 @@ class Zend_Soap_AutoDiscover_Recursion /** * @return Zend_Soap_AutoDiscover_Recursion */ - public function create() {} + public function create() + { + } } /** diff --git a/test/_files/fulltests/server1.php b/test/_files/fulltests/server1.php index ffe014ca..af3860d3 100644 --- a/test/_files/fulltests/server1.php +++ b/test/_files/fulltests/server1.php @@ -33,7 +33,7 @@ public function request($request) $a->baz[] = $request; - return array($a); + return [$a]; } } @@ -54,7 +54,7 @@ class Zend_Soap_Wsdl_ComplexTypeA /** * @var Zend_Soap_Wsdl_ComplexTypeB[] */ - public $baz = array(); + public $baz = []; } if (isset($_GET['wsdl'])) { From 7ef3a80bf51c8bfb946ca85b81277a49e21c107c Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Thu, 21 Apr 2016 10:59:18 -0500 Subject: [PATCH 2/3] Require PHP 7 to build --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5bb503e2..92393090 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,7 +35,6 @@ matrix: - php: 7 - php: hhvm allow_failures: - - php: 7 - php: hhvm notifications: From f91ab53408c78625ea0f0ab429357a0af0e26f0e Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Thu, 21 Apr 2016 11:01:58 -0500 Subject: [PATCH 3/3] Added CHANGELOG for #21 --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 83759bb5..4a42fafa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to this project will be documented in this file, in reverse chronological order by release. -## 2.5.2 - 2016-04-20 +## 2.5.2 - 2016-04-21 ### Added @@ -20,3 +20,5 @@ All notable changes to this project will be documented in this file, in reverse - [#7](https://github.com/zendframework/zend-soap/pull/7) fixes behavior when the request contains empty content. +- [#21](https://github.com/zendframework/zend-soap/pull/21) updates the + dependencies to allow usage with zend-stdlib v3 releases.