Added phing for running tests & fixed issues in order to pass the tests

This commit is contained in:
Petr Bechyně 2017-06-07 15:50:04 +02:00
parent b9e36b4900
commit 2264e329a1
47 changed files with 1349 additions and 394 deletions

View File

@ -5,21 +5,12 @@ php:
- 5.4 - 5.4
- 5.5 - 5.5
- 5.6 - 5.6
- 7.0
env: - 7.1
- SYMFONY_VERSION=2.6.*
- SYMFONY_VERSION="dev-master symfony/debug:~2.7@dev symfony/http-kernel:~2.7@dev"
before_script: before_script:
- composer self-update - composer self-update
- composer require symfony/framework-bundle:${SYMFONY_VERSION} --no-update - composer install
- composer update --no-interaction --prefer-source
- ./src/BeSimple/SoapClient/Tests/bin/phpwebserver.sh
- ./src/BeSimple/SoapClient/Tests/bin/axis.sh
script: script:
- phpunit --coverage-text - vendor/phing/phing/bin/phing -f build.xml
matrix:
allow_failures:
- env: SYMFONY_VERSION="dev-master symfony/debug:~2.7@dev symfony/http-kernel:~2.7@dev"

54
build.xml Normal file
View File

@ -0,0 +1,54 @@
<project name="be-simple-soap" default="build">
<property environment="env"/>
<fileset id="src" dir="${project.basedir}/src">
<include name="**/*.php"/>
<exclude name="BeSimple/SoapBundle/**/*.php"/>
<exclude name="BeSimple/SoapCommon/Type/**/*.php"/>
</fileset>
<fileset id="tests" dir="${project.basedir}/tests">
<include name="**/*.php"/>
</fileset>
<target name="cleanup" description="Workspace cleanup">
<delete>
<fileset dir="${project.basedir}/cache">
<include name="**/*"/>
<exclude name=".gitkeep"/>
</fileset>
</delete>
</target>
<target name="prepare" depends="cleanup" description="Workspace preparation">
<echo>project.basedir: ${project.basedir}</echo>
<property name="buildOutputPath" value="${project.basedir}/cache"/>
<echo>buildOutputPath: ${buildOutputPath}</echo>
</target>
<target name="lint" depends="prepare" description="PHP Lint check">
<phplint haltonfailure="true" level="debug" deprecatedAsError="true" tofile="${buildOutputPath}/phplint-outfile.txt">
<fileset refid="src"/>
</phplint>
</target>
<target name="varDump" depends="prepare" description="Check for forgotten var_dumps">
<exec command="${project.basedir}/vendor/bin/var-dump-check --exclude app --exclude vendor ." passthru="true" checkreturn="true"/>
</target>
<target name="phpcs" depends="prepare" description="PHP_CodeSniffer checks">
<exec command="php vendor/squizlabs/php_codesniffer/bin/phpcs --ignore=BeSimple/SoapBundle/,BeSimple/SoapCommon/Type/ --standard=${project.basedir}/codesniffer-ruleset.xml --report=checkstyle --report-file=${buildOutputPath}/phpcs-checkstyle-outfile.xml src tests" passthru="true" checkreturn="true"/>
</target>
<target name="phpstan" depends="prepare" description="phpstan checks">
<exec command="php vendor/bin/phpstan analyse src/BeSimple/SoapClient src/BeSimple/SoapServer > cache/phpstan-output.txt" passthru="true" checkreturn="true"/>
</target>
<target name="phpUnitTests" description="Run unit tests">
<exec command="php vendor/phpunit/phpunit/phpunit --configuration=phpunit.xml --testsuite=BeSimpleSoapTestSuite" passthru="true" checkreturn="true"/>
</target>
<target name="build" depends="prepare, varDump, lint, phpcs, phpstan, phpUnitTests" description="Meta target"/>
</project>

52
codesniffer-ruleset.xml Normal file
View File

@ -0,0 +1,52 @@
<?xml version="1.0"?>
<ruleset name="WSCBE">
<description>Coding standards</description>
<rule ref="Generic.Classes">
<exclude name="Generic.Classes.OpeningBraceSameLine.BraceOnNewLine"/>
</rule>
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
<rule ref="Generic.Files">
<properties>
<property name="eolChar" value="\n"/>
<property name="lineLimit" value="200"/>
<property name="absoluteLineLimit" value="220"/>
</properties>
<exclude name="Generic.Files.LowercasedFilename.NotFound"/>
<exclude name="Generic.Files.EndFileNoNewline.Found"/>
</rule>
<rule ref="Generic.PHP">
<exclude name="Generic.PHP.UpperCaseConstant.Found"/>
<exclude name="Generic.PHP.ClosingPHPTag.NotFound"/>
<exclude name="Generic.PHP.NoSilencedErrors.Discouraged"/> <!-- unfortunately, the only way to make native SoapClient work correctly -->
</rule>
<rule ref="Generic.NamingConventions"/>
<rule ref="Generic.Functions">
<exclude name="Generic.Functions.OpeningFunctionBraceKernighanRitchie.BraceOnNewLine"/>
<exclude name="Generic.Functions.OpeningFunctionBraceBsdAllman.BraceOnSameLine"/>
</rule>
<rule ref="PSR1.Classes"/>
<rule ref="PSR1.Files"/>
<rule ref="PSR1.Methods"/>
<rule ref="PSR2.Classes"/>
<rule ref="PSR2.ControlStructures"/>
<rule ref="PSR2.Files"/>
<rule ref="PSR2.Methods"/>
<rule ref="PSR2.Namespaces"/>
<rule ref="Squiz.Classes">
<exclude name="Squiz.Classes.ClassDeclaration.EndFileAfterCloseBrace"/>
</rule>
<rule ref="Squiz.Functions">
<exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpaceAfterDefault"/>
<exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpaceBeforeEquals"/>
</rule>
<!--<rule ref="Squiz.PHP"/>-->
<rule ref="Squiz.Objects">
<exclude name="Squiz.Objects.ObjectInstantiation.NotAssigned"/>
</rule>
<rule ref="Squiz.Scope"/>
</ruleset>

View File

@ -39,7 +39,11 @@
"require-dev": { "require-dev": {
"ext-mcrypt": "*", "ext-mcrypt": "*",
"mikey179/vfsStream": "~1.0", "mikey179/vfsStream": "~1.0",
"phpunit/phpunit": "~4.0" "phpunit/phpunit": "~4.0",
"phpstan/phpstan": "dev-master",
"phing/phing": "^2.16",
"jakub-onderka/php-var-dump-check": "^0.2.0",
"squizlabs/php_codesniffer": "^3.0"
}, },
"autoload": { "autoload": {
"psr-0": { "BeSimple\\": "src/" } "psr-0": { "BeSimple\\": "src/" }
@ -53,5 +57,11 @@
"branch-alias": { "branch-alias": {
"dev-master": "0.4-dev" "dev-master": "0.4-dev"
} }
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/tuscanicz/phpstan.git"
} }
]
} }

1084
composer.lock generated
View File

@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"hash": "7601f1ec280c086361e1deaf021f8ca1", "hash": "635c398afa1d5c217b5b8679b348ddc7",
"content-hash": "59372f34124af17d5c35938dfffc6075", "content-hash": "08f419455dd969e9145b8adfc84a03e9",
"packages": [ "packages": [
{ {
"name": "ass/xmlsecurity", "name": "ass/xmlsecurity",
@ -229,6 +229,52 @@
], ],
"time": "2015-06-14 21:17:01" "time": "2015-06-14 21:17:01"
}, },
{
"name": "jakub-onderka/php-var-dump-check",
"version": "v0.2",
"source": {
"type": "git",
"url": "https://github.com/JakubOnderka/PHP-Var-Dump-Check.git",
"reference": "c00c52f1503c537a3da394520717a7331eb290a1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/JakubOnderka/PHP-Var-Dump-Check/zipball/c00c52f1503c537a3da394520717a7331eb290a1",
"reference": "c00c52f1503c537a3da394520717a7331eb290a1",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"jakub-onderka/php-parallel-lint": "~0.8",
"phpunit/phpunit": "~4.5"
},
"suggest": {
"jakub-onderka/php-console-highlighter": "For colored console output"
},
"bin": [
"var-dump-check"
],
"type": "library",
"autoload": {
"psr-0": {
"JakubOnderka\\PhpVarDumpCheck": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-2-Clause"
],
"authors": [
{
"name": "Jakub Onderka",
"email": "jakub.onderka@gmail.com"
}
],
"description": "Find forgotten variables dump in PHP source code.",
"time": "2015-03-13 12:02:23"
},
{ {
"name": "mikey179/vfsStream", "name": "mikey179/vfsStream",
"version": "v1.6.4", "version": "v1.6.4",
@ -275,6 +321,643 @@
"homepage": "http://vfs.bovigo.org/", "homepage": "http://vfs.bovigo.org/",
"time": "2016-07-18 14:02:57" "time": "2016-07-18 14:02:57"
}, },
{
"name": "nette/bootstrap",
"version": "v2.4.3",
"source": {
"type": "git",
"url": "https://github.com/nette/bootstrap.git",
"reference": "2c27747f5aff2e436ebf542e0ea566bea1db2d53"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/bootstrap/zipball/2c27747f5aff2e436ebf542e0ea566bea1db2d53",
"reference": "2c27747f5aff2e436ebf542e0ea566bea1db2d53",
"shasum": ""
},
"require": {
"nette/di": "~2.4.7",
"nette/utils": "~2.4",
"php": ">=5.6.0"
},
"conflict": {
"nette/nette": "<2.2"
},
"require-dev": {
"latte/latte": "~2.2",
"nette/application": "~2.3",
"nette/caching": "~2.3",
"nette/database": "~2.3",
"nette/forms": "~2.3",
"nette/http": "~2.4.0",
"nette/mail": "~2.3",
"nette/robot-loader": "^2.4.2 || ^3.0",
"nette/safe-stream": "~2.2",
"nette/security": "~2.3",
"nette/tester": "~2.0",
"tracy/tracy": "^2.4.1"
},
"suggest": {
"nette/robot-loader": "to use Configurator::createRobotLoader()",
"tracy/tracy": "to use Configurator::enableTracy()"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.4-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause",
"GPL-2.0",
"GPL-3.0"
],
"authors": [
{
"name": "David Grudl",
"homepage": "https://davidgrudl.com"
},
{
"name": "Nette Community",
"homepage": "https://nette.org/contributors"
}
],
"description": "Nette Bootstrap",
"homepage": "https://nette.org",
"time": "2017-02-19 22:15:02"
},
{
"name": "nette/caching",
"version": "v2.5.3",
"source": {
"type": "git",
"url": "https://github.com/nette/caching.git",
"reference": "2436e530484a346d0a246733519ceaa40b943bd6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/caching/zipball/2436e530484a346d0a246733519ceaa40b943bd6",
"reference": "2436e530484a346d0a246733519ceaa40b943bd6",
"shasum": ""
},
"require": {
"nette/finder": "^2.2 || ~3.0.0",
"nette/utils": "^2.4 || ~3.0.0",
"php": ">=5.6.0"
},
"conflict": {
"nette/nette": "<2.2"
},
"require-dev": {
"latte/latte": "^2.4",
"nette/di": "^2.4 || ~3.0.0",
"nette/tester": "^2.0",
"tracy/tracy": "^2.4"
},
"suggest": {
"ext-pdo_sqlite": "to use SQLiteStorage or SQLiteJournal"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.5-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause",
"GPL-2.0",
"GPL-3.0"
],
"authors": [
{
"name": "David Grudl",
"homepage": "https://davidgrudl.com"
},
{
"name": "Nette Community",
"homepage": "https://nette.org/contributors"
}
],
"description": "Nette Caching Component",
"homepage": "https://nette.org",
"time": "2017-01-29 20:40:55"
},
{
"name": "nette/di",
"version": "v2.4.8",
"source": {
"type": "git",
"url": "https://github.com/nette/di.git",
"reference": "b3fe8551162279216e251e49b406e55cd2d255d5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/di/zipball/b3fe8551162279216e251e49b406e55cd2d255d5",
"reference": "b3fe8551162279216e251e49b406e55cd2d255d5",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"nette/neon": "^2.3.3 || ~3.0.0",
"nette/php-generator": "^2.6.1 || ~3.0.0",
"nette/utils": "^2.4.3 || ~3.0.0",
"php": ">=5.6.0"
},
"conflict": {
"nette/bootstrap": "<2.4",
"nette/nette": "<2.2"
},
"require-dev": {
"nette/tester": "^2.0",
"tracy/tracy": "^2.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.4-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause",
"GPL-2.0",
"GPL-3.0"
],
"authors": [
{
"name": "David Grudl",
"homepage": "https://davidgrudl.com"
},
{
"name": "Nette Community",
"homepage": "https://nette.org/contributors"
}
],
"description": "Nette Dependency Injection Component",
"homepage": "https://nette.org",
"time": "2017-03-14 17:16:14"
},
{
"name": "nette/finder",
"version": "v2.4.0",
"source": {
"type": "git",
"url": "https://github.com/nette/finder.git",
"reference": "5cabd5fe89f9903715359a403b820c7f94f9bb5e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/finder/zipball/5cabd5fe89f9903715359a403b820c7f94f9bb5e",
"reference": "5cabd5fe89f9903715359a403b820c7f94f9bb5e",
"shasum": ""
},
"require": {
"nette/utils": "~2.4",
"php": ">=5.6.0"
},
"conflict": {
"nette/nette": "<2.2"
},
"require-dev": {
"nette/tester": "~2.0",
"tracy/tracy": "^2.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.4-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause",
"GPL-2.0",
"GPL-3.0"
],
"authors": [
{
"name": "David Grudl",
"homepage": "https://davidgrudl.com"
},
{
"name": "Nette Community",
"homepage": "https://nette.org/contributors"
}
],
"description": "Nette Finder: Files Searching",
"homepage": "https://nette.org",
"time": "2016-05-17 15:49:06"
},
{
"name": "nette/neon",
"version": "v2.4.1",
"source": {
"type": "git",
"url": "https://github.com/nette/neon.git",
"reference": "1a78ff64b1e161ebccc03bdf9366450a69365f5b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/neon/zipball/1a78ff64b1e161ebccc03bdf9366450a69365f5b",
"reference": "1a78ff64b1e161ebccc03bdf9366450a69365f5b",
"shasum": ""
},
"require": {
"ext-iconv": "*",
"ext-json": "*",
"php": ">=5.6.0"
},
"require-dev": {
"nette/tester": "~2.0",
"tracy/tracy": "^2.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.4-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause",
"GPL-2.0",
"GPL-3.0"
],
"authors": [
{
"name": "David Grudl",
"homepage": "https://davidgrudl.com"
},
{
"name": "Nette Community",
"homepage": "https://nette.org/contributors"
}
],
"description": "Nette NEON: parser & generator for Nette Object Notation",
"homepage": "http://ne-on.org",
"time": "2017-01-13 08:00:19"
},
{
"name": "nette/php-generator",
"version": "v3.0.0",
"source": {
"type": "git",
"url": "https://github.com/nette/php-generator.git",
"reference": "8605fd18857a4beef4aa0afc19eb9a7f876237e8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/php-generator/zipball/8605fd18857a4beef4aa0afc19eb9a7f876237e8",
"reference": "8605fd18857a4beef4aa0afc19eb9a7f876237e8",
"shasum": ""
},
"require": {
"nette/utils": "^2.4.2 || ~3.0.0",
"php": ">=7.0"
},
"conflict": {
"nette/nette": "<2.2"
},
"require-dev": {
"nette/tester": "^2.0",
"tracy/tracy": "^2.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause",
"GPL-2.0",
"GPL-3.0"
],
"authors": [
{
"name": "David Grudl",
"homepage": "https://davidgrudl.com"
},
{
"name": "Nette Community",
"homepage": "https://nette.org/contributors"
}
],
"description": "🐘 Generates neat PHP code for you. Supports new PHP 7.1 features.",
"homepage": "https://nette.org",
"keywords": [
"code",
"nette",
"php",
"scaffolding"
],
"time": "2017-03-18 15:20:10"
},
{
"name": "nette/robot-loader",
"version": "v3.0.0",
"source": {
"type": "git",
"url": "https://github.com/nette/robot-loader.git",
"reference": "459fc6bf08f0fd7f6889897e3acdff523dbf1159"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/robot-loader/zipball/459fc6bf08f0fd7f6889897e3acdff523dbf1159",
"reference": "459fc6bf08f0fd7f6889897e3acdff523dbf1159",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"nette/finder": "^2.3 || ^3.0",
"nette/utils": "^2.4 || ^3.0",
"php": ">=5.6.0"
},
"conflict": {
"nette/nette": "<2.2"
},
"require-dev": {
"nette/tester": "^2.0",
"tracy/tracy": "^2.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause",
"GPL-2.0",
"GPL-3.0"
],
"authors": [
{
"name": "David Grudl",
"homepage": "https://davidgrudl.com"
},
{
"name": "Nette Community",
"homepage": "https://nette.org/contributors"
}
],
"description": "🍀 RobotLoader: high performance and comfortable autoloader that will search and autoload classes within your application.",
"homepage": "https://nette.org",
"keywords": [
"autoload",
"class",
"interface",
"nette",
"trait"
],
"time": "2017-02-10 13:44:22"
},
{
"name": "nette/utils",
"version": "v2.4.6",
"source": {
"type": "git",
"url": "https://github.com/nette/utils.git",
"reference": "266160aec0d99516e0ea510de1dfa24a0dc1e76e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/utils/zipball/266160aec0d99516e0ea510de1dfa24a0dc1e76e",
"reference": "266160aec0d99516e0ea510de1dfa24a0dc1e76e",
"shasum": ""
},
"require": {
"php": ">=5.6.0"
},
"conflict": {
"nette/nette": "<2.2"
},
"require-dev": {
"nette/tester": "~2.0",
"tracy/tracy": "^2.3"
},
"suggest": {
"ext-gd": "to use Image",
"ext-iconv": "to use Strings::webalize() and toAscii()",
"ext-intl": "for script transliteration in Strings::webalize() and toAscii()",
"ext-json": "to use Nette\\Utils\\Json",
"ext-mbstring": "to use Strings::lower() etc...",
"ext-xml": "to use Strings::length() etc. when mbstring is not available"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.4-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause",
"GPL-2.0",
"GPL-3.0"
],
"authors": [
{
"name": "David Grudl",
"homepage": "https://davidgrudl.com"
},
{
"name": "Nette Community",
"homepage": "https://nette.org/contributors"
}
],
"description": "Nette Utility Classes",
"homepage": "https://nette.org",
"time": "2017-04-26 10:04:49"
},
{
"name": "nikic/php-parser",
"version": "v3.0.5",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "2b9e2f71b722f7c53918ab0c25f7646c2013f17d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/2b9e2f71b722f7c53918ab0c25f7646c2013f17d",
"reference": "2b9e2f71b722f7c53918ab0c25f7646c2013f17d",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": ">=5.5"
},
"require-dev": {
"phpunit/phpunit": "~4.0|~5.0"
},
"bin": [
"bin/php-parse"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"psr-4": {
"PhpParser\\": "lib/PhpParser"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Nikita Popov"
}
],
"description": "A PHP parser written in PHP",
"keywords": [
"parser",
"php"
],
"time": "2017-03-05 18:23:57"
},
{
"name": "phing/phing",
"version": "2.16.0",
"source": {
"type": "git",
"url": "https://github.com/phingofficial/phing.git",
"reference": "151a0f4d8cebf7711eccc62dde3f09bc36a00d7b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phingofficial/phing/zipball/151a0f4d8cebf7711eccc62dde3f09bc36a00d7b",
"reference": "151a0f4d8cebf7711eccc62dde3f09bc36a00d7b",
"shasum": ""
},
"require": {
"php": ">=5.2.0",
"symfony/yaml": "^3.1"
},
"require-dev": {
"ext-pdo_sqlite": "*",
"mikey179/vfsstream": "^1.6",
"pdepend/pdepend": "2.x",
"pear/archive_tar": "1.4.x",
"pear/http_request2": "dev-trunk",
"pear/net_growl": "dev-trunk",
"pear/pear-core-minimal": "1.10.1",
"pear/versioncontrol_git": "@dev",
"pear/versioncontrol_svn": "~0.5",
"phpdocumentor/phpdocumentor": "2.x",
"phploc/phploc": "~2.0.6",
"phpmd/phpmd": "~2.2",
"phpunit/phpunit": ">=3.7",
"sebastian/git": "~1.0",
"sebastian/phpcpd": "2.x",
"siad007/versioncontrol_hg": "^1.0",
"simpletest/simpletest": "^1.1",
"squizlabs/php_codesniffer": "~2.2"
},
"suggest": {
"pdepend/pdepend": "PHP version of JDepend",
"pear/archive_tar": "Tar file management class",
"pear/versioncontrol_git": "A library that provides OO interface to handle Git repository",
"pear/versioncontrol_svn": "A simple OO-style interface for Subversion, the free/open-source version control system",
"phpdocumentor/phpdocumentor": "Documentation Generator for PHP",
"phploc/phploc": "A tool for quickly measuring the size of a PHP project",
"phpmd/phpmd": "PHP version of PMD tool",
"phpunit/php-code-coverage": "Library that provides collection, processing, and rendering functionality for PHP code coverage information",
"phpunit/phpunit": "The PHP Unit Testing Framework",
"sebastian/phpcpd": "Copy/Paste Detector (CPD) for PHP code",
"siad007/versioncontrol_hg": "A library for interfacing with Mercurial repositories.",
"tedivm/jshrink": "Javascript Minifier built in PHP"
},
"bin": [
"bin/phing"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.16.x-dev"
}
},
"autoload": {
"classmap": [
"classes/phing/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
"classes"
],
"license": [
"LGPL-3.0"
],
"authors": [
{
"name": "Michiel Rook",
"email": "mrook@php.net"
},
{
"name": "Phing Community",
"homepage": "https://www.phing.info/trac/wiki/Development/Contributors"
}
],
"description": "PHing Is Not GNU make; it's a PHP project build system or build tool based on Apache Ant.",
"homepage": "https://www.phing.info/",
"keywords": [
"build",
"phing",
"task",
"tool"
],
"time": "2016-12-22 20:16:33"
},
{ {
"name": "phpdocumentor/reflection-common", "name": "phpdocumentor/reflection-common",
"version": "1.0", "version": "1.0",
@ -484,6 +1167,68 @@
], ],
"time": "2016-11-21 14:58:47" "time": "2016-11-21 14:58:47"
}, },
{
"name": "phpstan/phpstan",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/tuscanicz/phpstan.git",
"reference": "11d705360de768c8f0f9431288228ecd85ac14dd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tuscanicz/phpstan/zipball/11d705360de768c8f0f9431288228ecd85ac14dd",
"reference": "11d705360de768c8f0f9431288228ecd85ac14dd",
"shasum": ""
},
"require": {
"nette/bootstrap": "^2.4 || ^3.0",
"nette/caching": "^2.4 || ^3.0",
"nette/di": "^2.4 || ^3.0",
"nette/robot-loader": "^2.4.2 || ^3.0",
"nette/utils": "^2.4 || ^3.0",
"nikic/php-parser": "^2.1 || ^3.0.2",
"php": "~7.0",
"symfony/console": "~2.7 || ~3.0",
"symfony/finder": "~2.7 || ~3.0"
},
"require-dev": {
"consistence/coding-standard": "~0.13.0",
"jakub-onderka/php-parallel-lint": "^0.9.2",
"phing/phing": "^2.16.0",
"phpunit/phpunit": "^6.0.7",
"satooshi/php-coveralls": "^1.0",
"slevomat/coding-standard": "^2.0"
},
"bin": [
"bin/phpstan"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "0.7-dev"
}
},
"autoload": {
"psr-4": {
"PHPStan\\": "src/"
}
},
"autoload-dev": {
"classmap": [
"tests/PHPStan",
"tests/TestCase.php"
]
},
"license": [
"MIT"
],
"description": "PHPStan - PHP Static Analysis Tool",
"support": {
"source": "https://github.com/tuscanicz/phpstan/tree/master"
},
"time": "2017-06-07 13:05:16"
},
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",
"version": "2.2.4", "version": "2.2.4",
@ -855,6 +1600,53 @@
], ],
"time": "2015-10-02 06:51:40" "time": "2015-10-02 06:51:40"
}, },
{
"name": "psr/log",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Log\\": "Psr/Log/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for logging libraries",
"homepage": "https://github.com/php-fig/log",
"keywords": [
"log",
"psr",
"psr-3"
],
"time": "2016-10-10 12:19:37"
},
{ {
"name": "sebastian/comparator", "name": "sebastian/comparator",
"version": "1.2.4", "version": "1.2.4",
@ -1227,6 +2019,290 @@
"homepage": "https://github.com/sebastianbergmann/version", "homepage": "https://github.com/sebastianbergmann/version",
"time": "2015-06-21 13:59:46" "time": "2015-06-21 13:59:46"
}, },
{
"name": "squizlabs/php_codesniffer",
"version": "3.0.0",
"source": {
"type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "b95ff2c3b122a3ee4b57d149a57d2afce65522c3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/b95ff2c3b122a3ee4b57d149a57d2afce65522c3",
"reference": "b95ff2c3b122a3ee4b57d149a57d2afce65522c3",
"shasum": ""
},
"require": {
"ext-simplexml": "*",
"ext-tokenizer": "*",
"ext-xmlwriter": "*",
"php": ">=5.4.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
},
"bin": [
"bin/phpcs",
"bin/phpcbf"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.x-dev"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Greg Sherwood",
"role": "lead"
}
],
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
"homepage": "http://www.squizlabs.com/php-codesniffer",
"keywords": [
"phpcs",
"standards"
],
"time": "2017-05-04 00:33:04"
},
{
"name": "symfony/console",
"version": "v3.3.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "70d2a29b2911cbdc91a7e268046c395278238b2e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/70d2a29b2911cbdc91a7e268046c395278238b2e",
"reference": "70d2a29b2911cbdc91a7e268046c395278238b2e",
"shasum": ""
},
"require": {
"php": ">=5.5.9",
"symfony/debug": "~2.8|~3.0",
"symfony/polyfill-mbstring": "~1.0"
},
"conflict": {
"symfony/dependency-injection": "<3.3"
},
"require-dev": {
"psr/log": "~1.0",
"symfony/config": "~3.3",
"symfony/dependency-injection": "~3.3",
"symfony/event-dispatcher": "~2.8|~3.0",
"symfony/filesystem": "~2.8|~3.0",
"symfony/http-kernel": "~2.8|~3.0",
"symfony/process": "~2.8|~3.0"
},
"suggest": {
"psr/log": "For using the console logger",
"symfony/event-dispatcher": "",
"symfony/filesystem": "",
"symfony/process": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.3-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Console\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"time": "2017-06-02 19:24:58"
},
{
"name": "symfony/debug",
"version": "v3.3.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/debug.git",
"reference": "e9c50482841ef696e8fa1470d950a79c8921f45d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/debug/zipball/e9c50482841ef696e8fa1470d950a79c8921f45d",
"reference": "e9c50482841ef696e8fa1470d950a79c8921f45d",
"shasum": ""
},
"require": {
"php": ">=5.5.9",
"psr/log": "~1.0"
},
"conflict": {
"symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2"
},
"require-dev": {
"symfony/http-kernel": "~2.8|~3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.3-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Debug\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Debug Component",
"homepage": "https://symfony.com",
"time": "2017-06-01 21:01:25"
},
{
"name": "symfony/finder",
"version": "v3.3.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "baea7f66d30854ad32988c11a09d7ffd485810c4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/baea7f66d30854ad32988c11a09d7ffd485810c4",
"reference": "baea7f66d30854ad32988c11a09d7ffd485810c4",
"shasum": ""
},
"require": {
"php": ">=5.5.9"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.3-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Finder\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
"time": "2017-06-01 21:01:25"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.3.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "e79d363049d1c2128f133a2667e4f4190904f7f4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4",
"reference": "e79d363049d1c2128f133a2667e4f4190904f7f4",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"ext-mbstring": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for the Mbstring extension",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"mbstring",
"polyfill",
"portable",
"shim"
],
"time": "2016-11-14 01:06:16"
},
{ {
"name": "symfony/yaml", "name": "symfony/yaml",
"version": "v3.2.2", "version": "v3.2.2",
@ -1335,7 +2411,9 @@
], ],
"aliases": [], "aliases": [],
"minimum-stability": "stable", "minimum-stability": "stable",
"stability-flags": [], "stability-flags": {
"phpstan/phpstan": 20
},
"prefer-stable": false, "prefer-stable": false,
"prefer-lowest": false, "prefer-lowest": false,
"platform": { "platform": {

6
phing Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env php
<?php
putenv("PHING_HOME=" . realpath(dirname(__FILE__)));
require_once __DIR__ . '/vendor/phing/phing/bin/phing.php';

View File

@ -20,4 +20,9 @@
<directory>tests</directory> <directory>tests</directory>
</testsuite> </testsuite>
</testsuites> </testsuites>
<logging>
<log type="coverage-text" target="php://stdout" showUncoveredFiles="true" showOnlySummary="true"/>
<log type="coverage-clover" target="cache/clover.xml"/>
</logging>
</phpunit> </phpunit>

View File

@ -12,7 +12,7 @@ namespace BeSimple\SoapBundle\Converter;
use BeSimple\SoapBundle\Soap\SoapRequest; use BeSimple\SoapBundle\Soap\SoapRequest;
use BeSimple\SoapBundle\Soap\SoapResponse; use BeSimple\SoapBundle\Soap\SoapResponse;
use BeSimple\SoapBundle\Util\String; use BeSimple\SoapBundle\Util\StringUtility;
use BeSimple\SoapCommon\Converter\TypeConverterInterface; use BeSimple\SoapCommon\Converter\TypeConverterInterface;
/** /**
@ -40,7 +40,7 @@ class XopIncludeTypeConverter implements TypeConverterInterface
$ref = $include->getAttribute('href'); $ref = $include->getAttribute('href');
if (String::startsWith($ref, 'cid:')) { if (StringUtility::startsWith($ref, 'cid:')) {
$cid = urldecode(substr($ref, 4)); $cid = urldecode(substr($ref, 4));
return $request->getSoapAttachments()->get($cid)->getContent(); return $request->getSoapAttachments()->get($cid)->getContent();

View File

@ -12,7 +12,7 @@
namespace BeSimple\SoapBundle\Handler; namespace BeSimple\SoapBundle\Handler;
use BeSimple\SoapServer\Exception\ReceiverSoapFault; use SoapFault;
use Symfony\Component\Debug\Exception\FlattenException; use Symfony\Component\Debug\Exception\FlattenException;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
@ -44,7 +44,8 @@ class ExceptionHandler
$code = $this->exception->getStatusCode(); $code = $this->exception->getStatusCode();
throw new ReceiverSoapFault( throw new SoapFault(
'receiver',
isset(Response::$statusTexts[$code]) ? Response::$statusTexts[$code] : '', isset(Response::$statusTexts[$code]) ? Response::$statusTexts[$code] : '',
null, null,
$this->details $this->details

View File

@ -7,7 +7,7 @@ Pre-existent Type
+------------------------------------------------+-----------------+ +------------------------------------------------+-----------------+
| Php Type | Value Type | | Php Type | Value Type |
+================================================+=================+ +================================================+=================+
| BeSimple\\SoapCommon\\Type\\KeyValue\\String | String | | BeSimple\\SoapCommon\\Type\\KeyValue\\StringUtility | StringUtility |
+------------------------------------------------+-----------------+ +------------------------------------------------+-----------------+
| BeSimple\\SoapCommon\\Type\\KeyValue\\Boolean | Boolean | | BeSimple\\SoapCommon\\Type\\KeyValue\\Boolean | Boolean |
+------------------------------------------------+-----------------+ +------------------------------------------------+-----------------+
@ -34,7 +34,7 @@ Controller
{ {
/** /**
* @Soap\Method("returnAssocArray") * @Soap\Method("returnAssocArray")
* @Soap\Result(phpType = "BeSimple\SoapCommon\Type\KeyValue\String[]") * @Soap\Result(phpType = "BeSimple\SoapCommon\Type\KeyValue\StringUtility[]")
*/ */
public function assocArrayOfStringAction() public function assocArrayOfStringAction()
{ {
@ -46,8 +46,8 @@ Controller
/** /**
* @Soap\Method("sendAssocArray") * @Soap\Method("sendAssocArray")
* @Soap\Param("assocArray", phpType = "BeSimple\SoapCommon\Type\KeyValue\String[]") * @Soap\Param("assocArray", phpType = "BeSimple\SoapCommon\Type\KeyValue\StringUtility[]")
* @Soap\Result(phpType = "BeSimple\SoapCommon\Type\KeyValue\String[]") * @Soap\Result(phpType = "BeSimple\SoapCommon\Type\KeyValue\StringUtility[]")
*/ */
public function sendAssocArrayOfStringAction(array $assocArray) public function sendAssocArrayOfStringAction(array $assocArray)
{ {

View File

@ -11,11 +11,11 @@
namespace BeSimple\SoapBundle\Util; namespace BeSimple\SoapBundle\Util;
/** /**
* String provides utility methods for strings. * StringUtility provides utility methods for strings.
* *
* @author Christian Kerl <christian-kerl@web.de> * @author Christian Kerl <christian-kerl@web.de>
*/ */
class String class StringUtility
{ {
/** /**
* Checks if a string starts with a given string. * Checks if a string starts with a given string.

View File

@ -50,13 +50,14 @@ class CurlOptionsBuilder
$basicAuthentication->getPassword() $basicAuthentication->getPassword()
); );
} else if ($soapClientOptions->hasAuthenticationDigest()) { }
if ($soapClientOptions->hasAuthenticationDigest()) {
return new HttpAuthenticationDigestOptions(); return new HttpAuthenticationDigestOptions();
} else {
throw new Exception('Unresolved authentication type: '.get_class($soapClientOptions->getAuthentication()));
} }
throw new Exception('Unresolved authentication type: '.get_class($soapClientOptions->getAuthentication()));
} }
return null; return null;

View File

@ -43,8 +43,6 @@ class SoapClient extends \SoapClient
{ {
use SoapClientNativeMethodsTrait; use SoapClientNativeMethodsTrait;
/** @var SoapClientOptions */
protected $soapClientOptions;
/** @var SoapOptions */ /** @var SoapOptions */
protected $soapOptions; protected $soapOptions;
/** @var Curl */ /** @var Curl */

View File

@ -9,6 +9,7 @@ use Exception;
trait SoapClientNativeMethodsTrait trait SoapClientNativeMethodsTrait
{ {
protected $soapClientOptions;
/** @var SoapAttachment[] */ /** @var SoapAttachment[] */
private $soapAttachmentsOnRequestStorage; private $soapAttachmentsOnRequestStorage;
/** @var SoapResponse */ /** @var SoapResponse */

View File

@ -94,16 +94,16 @@ class WsAddressingFilter implements SoapRequestFilter, SoapResponseFilter
/** /**
* List of reference parameters associated with this soap message. * List of reference parameters associated with this soap message.
* *
* @var unknown_type * @var array
*/ */
protected $referenceParametersSet = array(); protected $referenceParametersSet;
/** /**
* List of reference parameters recieved with this soap message. * List of reference parameters recieved with this soap message.
* *
* @var unknown_type * @var array
*/ */
protected $referenceParametersRecieved = array(); protected $referenceParametersRecieved;
/** /**
* RelatesTo. * RelatesTo.
@ -214,7 +214,7 @@ class WsAddressingFilter implements SoapRequestFilter, SoapResponseFilter
public function setMessageId($messageId = null) public function setMessageId($messageId = null)
{ {
if (null === $messageId) { if (null === $messageId) {
$messageId = 'uuid:' . Helper::generateUUID(); $messageId = 'uuid:' . Helper::generateUuid();
} }
$this->messageId = $messageId; $this->messageId = $messageId;
} }
@ -259,7 +259,7 @@ class WsAddressingFilter implements SoapRequestFilter, SoapResponseFilter
* *
* @return void * @return void
*/ */
public function filterRequest(CommonSoapRequest $request) public function filterRequest(CommonSoapRequest $request, $attachmentType)
{ {
// get \DOMDocument from SOAP request // get \DOMDocument from SOAP request
$dom = $request->getContentDocument(); $dom = $request->getContentDocument();
@ -328,7 +328,7 @@ class WsAddressingFilter implements SoapRequestFilter, SoapResponseFilter
* *
* @return void * @return void
*/ */
public function filterResponse(CommonSoapResponse $response) public function filterResponse(CommonSoapResponse $response, $attachmentType)
{ {
// get \DOMDocument from SOAP response // get \DOMDocument from SOAP response
$dom = $response->getContentDocument(); $dom = $response->getContentDocument();

View File

@ -104,10 +104,11 @@ class WsSecurityFilter extends WsSecurityFilterClientServer implements SoapReque
* Modify the given request XML. * Modify the given request XML.
* *
* @param \BeSimple\SoapCommon\SoapRequest $request SOAP request * @param \BeSimple\SoapCommon\SoapRequest $request SOAP request
* @param int $attachmentType
* *
* @return void * @return void
*/ */
public function filterRequest(CommonSoapRequest $request) public function filterRequest(CommonSoapRequest $request, $attachmentType)
{ {
// get \DOMDocument from SOAP request // get \DOMDocument from SOAP request
$dom = $request->getContentDocument(); $dom = $request->getContentDocument();
@ -174,7 +175,7 @@ class WsSecurityFilter extends WsSecurityFilterClientServer implements SoapReque
} }
if (null !== $this->userSecurityKey && $this->userSecurityKey->hasKeys()) { if (null !== $this->userSecurityKey && $this->userSecurityKey->hasKeys()) {
$guid = 'CertId-' . Helper::generateUUID(); $guid = 'CertId-' . Helper::generateUuid();
// add token references // add token references
$keyInfo = null; $keyInfo = null;
if (null !== $this->tokenReferenceSignature) { if (null !== $this->tokenReferenceSignature) {
@ -200,7 +201,7 @@ class WsSecurityFilter extends WsSecurityFilterClientServer implements SoapReque
// encrypt soap document // encrypt soap document
if (null !== $this->serviceSecurityKey && $this->serviceSecurityKey->hasKeys()) { if (null !== $this->serviceSecurityKey && $this->serviceSecurityKey->hasKeys()) {
$guid = 'EncKey-' . Helper::generateUUID(); $guid = 'EncKey-' . Helper::generateUuid();
// add token references // add token references
$keyInfo = null; $keyInfo = null;
if (null !== $this->tokenReferenceEncryption) { if (null !== $this->tokenReferenceEncryption) {
@ -226,10 +227,11 @@ class WsSecurityFilter extends WsSecurityFilterClientServer implements SoapReque
* Modify the given request XML. * Modify the given request XML.
* *
* @param \BeSimple\SoapCommon\SoapResponse $response SOAP response * @param \BeSimple\SoapCommon\SoapResponse $response SOAP response
* @param int $attachmentType
* *
* @return void * @return void
*/ */
public function filterResponse(CommonSoapResponse $response) public function filterResponse(CommonSoapResponse $response, $attachmentType)
{ {
// get \DOMDocument from SOAP response // get \DOMDocument from SOAP response
$dom = $response->getContentDocument(); $dom = $response->getContentDocument();

View File

@ -78,8 +78,8 @@ class WsdlDownloader
throw new Exception('Could not write WSDL cache file: empty curl response from: '.$wsdlPath); throw new Exception('Could not write WSDL cache file: empty curl response from: '.$wsdlPath);
} }
if ($resolveRemoteIncludes === true) { if ($resolveRemoteIncludes === true) {
$document = $this->getXmlFileDOMDocument($curl, $cacheType, $curlResponse->getResponseBody(), $wsdlPath); $document = $this->getXmlFileDomDocument($curl, $cacheType, $curlResponse->getResponseBody(), $wsdlPath);
$this->saveXmlDOMDocument($document, $cacheFilePath); $this->saveXmlDomDocument($document, $cacheFilePath);
} else { } else {
file_put_contents($cacheFilePath, $curlResponse->getResponseBody()); file_put_contents($cacheFilePath, $curlResponse->getResponseBody());
} }
@ -88,8 +88,8 @@ class WsdlDownloader
} }
} else { } else {
if (file_exists($wsdlPath)) { if (file_exists($wsdlPath)) {
$document = $this->getXmlFileDOMDocument($curl, $cacheType, file_get_contents($wsdlPath)); $document = $this->getXmlFileDomDocument($curl, $cacheType, file_get_contents($wsdlPath));
$this->saveXmlDOMDocument($document, $cacheFilePath); $this->saveXmlDomDocument($document, $cacheFilePath);
} else { } else {
throw new Exception('Could write WSDL cache file: local file does not exist: '.$wsdlPath); throw new Exception('Could write WSDL cache file: local file does not exist: '.$wsdlPath);
} }
@ -102,9 +102,9 @@ class WsdlDownloader
return realpath($wsdlPath); return realpath($wsdlPath);
} else {
throw new Exception('Could not download WSDL: local file does not exist: '.$wsdlPath);
} }
throw new Exception('Could not download WSDL: local file does not exist: '.$wsdlPath);
} }
/** /**
@ -118,12 +118,10 @@ class WsdlDownloader
if (isset($parsedUrlOrFalse['scheme']) && substr($parsedUrlOrFalse['scheme'], 0, 4) === 'http') { if (isset($parsedUrlOrFalse['scheme']) && substr($parsedUrlOrFalse['scheme'], 0, 4) === 'http') {
return true; return true;
}
} else {
return false; return false;
} }
}
throw new Exception('Could not determine wsdlPath is remote: '.$wsdlPath); throw new Exception('Could not determine wsdlPath is remote: '.$wsdlPath);
} }
@ -137,7 +135,7 @@ class WsdlDownloader
* @param boolean $parentFilePath Parent file name * @param boolean $parentFilePath Parent file name
* @return DOMDocument * @return DOMDocument
*/ */
private function getXmlFileDOMDocument(Curl $curl, $cacheType, $xmlFileSource, $parentFilePath = null) private function getXmlFileDomDocument(Curl $curl, $cacheType, $xmlFileSource, $parentFilePath = null)
{ {
$document = new DOMDocument('1.0', 'utf-8'); $document = new DOMDocument('1.0', 'utf-8');
if ($document->loadXML($xmlFileSource) === false) { if ($document->loadXML($xmlFileSource) === false) {
@ -151,7 +149,7 @@ class WsdlDownloader
return $document; return $document;
} }
private function saveXmlDOMDocument(DOMDocument $document, $cacheFilePath) private function saveXmlDomDocument(DOMDocument $document, $cacheFilePath)
{ {
try { try {
$xmlContents = $document->saveXML(); $xmlContents = $document->saveXML();

View File

@ -44,4 +44,3 @@ class DateTimeTypeConverter implements TypeConverterInterface
return sprintf('<%1$s>%2$s</%1$s>', $this->getTypeName(), $data->format('Y-m-d\TH:i:sP')); return sprintf('<%1$s>%2$s</%1$s>', $this->getTypeName(), $data->format('Y-m-d\TH:i:sP'));
} }
} }

View File

@ -44,4 +44,3 @@ class DateTypeConverter implements TypeConverterInterface
return sprintf('<%1$s>%2$s</%1$s>', $this->getTypeName(), $data->format('Y-m-d')); return sprintf('<%1$s>%2$s</%1$s>', $this->getTypeName(), $data->format('Y-m-d'));
} }
} }

View File

@ -24,14 +24,14 @@ interface TypeConverterInterface
* *
* @return string * @return string
*/ */
function getTypeNamespace(); public function getTypeNamespace();
/** /**
* Get type name. * Get type name.
* *
* @return string * @return string
*/ */
function getTypeName(); public function getTypeName();
/** /**
* Convert given XML string to PHP type. * Convert given XML string to PHP type.
@ -40,7 +40,7 @@ interface TypeConverterInterface
* *
* @return mixed * @return mixed
*/ */
function convertXmlToPhp($data); public function convertXmlToPhp($data);
/** /**
* Convert PHP type to XML string. * Convert PHP type to XML string.
@ -49,5 +49,5 @@ interface TypeConverterInterface
* *
* @return string * @return string
*/ */
function convertPhpToXml($data); public function convertPhpToXml($data);
} }

View File

@ -167,12 +167,13 @@ class Helper
* @see http://de.php.net/manual/en/function.uniqid.php#94959 * @see http://de.php.net/manual/en/function.uniqid.php#94959
* @return string * @return string
*/ */
public static function generateUUID() public static function generateUuid()
{ {
return sprintf( return sprintf(
'%04x%04x-%04x-%04x-%04x-%04x%04x%04x', '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
// 32 bits for "time_low" // 32 bits for "time_low"
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff),
mt_rand(0, 0xffff),
// 16 bits for "time_mid" // 16 bits for "time_mid"
mt_rand(0, 0xffff), mt_rand(0, 0xffff),
// 16 bits for "time_hi_and_version", // 16 bits for "time_hi_and_version",
@ -183,7 +184,9 @@ class Helper
// two most significant bits holds zero and one for variant DCE1.1 // two most significant bits holds zero and one for variant DCE1.1
mt_rand(0, 0x3fff) | 0x8000, mt_rand(0, 0x3fff) | 0x8000,
// 48 bits for "node" // 48 bits for "node"
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff) mt_rand(0, 0xffff),
mt_rand(0, 0xffff),
mt_rand(0, 0xffff)
); );
} }
@ -198,9 +201,9 @@ class Helper
{ {
if ($version === SOAP_1_2) { if ($version === SOAP_1_2) {
return self::NS_SOAP_1_2; return self::NS_SOAP_1_2;
} else {
return self::NS_SOAP_1_1;
} }
return self::NS_SOAP_1_1;
} }
/** /**
@ -214,8 +217,8 @@ class Helper
{ {
if ($namespace === self::NS_SOAP_1_2) { if ($namespace === self::NS_SOAP_1_2) {
return SOAP_1_2; return SOAP_1_2;
} else { }
return SOAP_1_1; return SOAP_1_1;
} }
} }
}

View File

@ -179,7 +179,7 @@ class MultiPart extends PartHeader
*/ */
public function generateBoundary() public function generateBoundary()
{ {
return 'multipart-boundary-' . Helper::generateUUID() . '@response.info'; return 'multipart-boundary-' . Helper::generateUuid() . '@response.info';
} }
public function getMainPartContentId() public function getMainPartContentId()

View File

@ -154,6 +154,6 @@ class Part extends PartHeader
*/ */
protected function generateContentId() protected function generateContentId()
{ {
return 'part-' . Helper::generateUUID() . '@response.info'; return 'part-' . Helper::generateUuid() . '@response.info';
} }
} }

View File

@ -92,14 +92,14 @@ abstract class SoapMessage
/** /**
* SOAP version (SOAP_1_1|SOAP_1_2) * SOAP version (SOAP_1_1|SOAP_1_2)
* *
* @var string * @var int
*/ */
protected $version; protected $version;
/** /**
* Get content type for given SOAP version. * Get content type for given SOAP version.
* *
* @param string $version SOAP version constant SOAP_1_1|SOAP_1_2 * @param int $version SOAP version constant SOAP_1_1|SOAP_1_2
* *
* @return string * @return string
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
@ -232,9 +232,9 @@ abstract class SoapMessage
} }
/** /**
* Get version. * Get SOAP version SOAP_1_1|SOAP_1_2
* *
* @return string * @return int
*/ */
public function getVersion() public function getVersion()
{ {
@ -244,7 +244,7 @@ abstract class SoapMessage
/** /**
* Set version. * Set version.
* *
* @param string $version SOAP version SOAP_1_1|SOAP_1_2 * @param int $version SOAP version SOAP_1_1|SOAP_1_2
*/ */
public function setVersion($version) public function setVersion($version)
{ {

View File

@ -36,7 +36,7 @@ class SoapRequestFactory
* *
* @param string $location Location * @param string $location Location
* @param string $action SOAP action * @param string $action SOAP action
* @param string $version SOAP version * @param int $version SOAP version
* @param string $content Content * @param string $content Content
* @return SoapRequest * @return SoapRequest
*/ */

View File

@ -1,211 +0,0 @@
<?php
/*
* This file is part of the BeSimpleSoapBundle.
*
* (c) Christian Kerl <christian-kerl@web.de>
* (c) Francis Besset <francis.besset@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace BeSimple\SoapCommon\Tests;
use BeSimple\SoapCommon\Cache;
use BeSimple\SoapCommon\Classmap;
use BeSimple\SoapCommon\Converter\DateTimeTypeConverter;
use BeSimple\SoapCommon\Converter\DateTypeConverter;
use BeSimple\SoapCommon\Converter\TypeConverterCollection;
use BeSimple\SoapCommon\Tests\Fixtures\SoapBuilder;
class AbstractSoapBuilderTest extends \PHPUnit_Framework_TestCase
{
private $defaultOptions = array(
'features' => 0,
'classmap' => array(),
'typemap' => array(),
);
public function testContruct()
{
$options = $this
->getSoapBuilder()
->getSoapOptions()
;
$this->assertEquals($this->mergeOptions(array()), $options);
}
public function testWithWsdl()
{
$builder = $this->getSoapBuilder();
$this->assertNull($builder->getWsdl());
$builder->withWsdl('http://myWsdl/?wsdl');
$this->assertEquals('http://myWsdl/?wsdl', $builder->getWsdl());
}
public function testWithSoapVersion()
{
$builder = $this->getSoapBuilder();
$builder->withSoapVersion11();
$this->assertEquals($this->mergeOptions(array('soap_version' => SOAP_1_1)), $builder->getSoapOptions());
$builder->withSoapVersion12();
$this->assertEquals($this->mergeOptions(array('soap_version' => SOAP_1_2)), $builder->getSoapOptions());
}
public function testWithEncoding()
{
$builder = $this
->getSoapBuilder()
->withEncoding('ISO 8859-15')
;
$this->assertEquals($this->mergeOptions(array('encoding' => 'ISO 8859-15')), $builder->getSoapOptions());
}
public function testWithWsdlCache()
{
$builder = $this->getSoapBuilder();
$builder->withWsdlCache(Cache::TYPE_DISK_MEMORY);
$this->assertEquals($this->mergeOptions(array('cache_wsdl' => Cache::TYPE_DISK_MEMORY)), $builder->getSoapOptions());
$builder->withWsdlCacheNone();
$this->assertEquals($this->mergeOptions(array('cache_wsdl' => Cache::TYPE_NONE)), $builder->getSoapOptions());
$builder->withWsdlCacheDisk();
$this->assertEquals($this->mergeOptions(array('cache_wsdl' => Cache::TYPE_DISK)), $builder->getSoapOptions());
$builder->withWsdlCacheMemory();
$this->assertEquals($this->mergeOptions(array('cache_wsdl' => Cache::TYPE_MEMORY)), $builder->getSoapOptions());
$builder->withWsdlCacheDiskAndMemory();
$this->assertEquals($this->mergeOptions(array('cache_wsdl' => Cache::TYPE_DISK_MEMORY)), $builder->getSoapOptions());
}
public function testWithWsdlCacheBadValue()
{
$builder = $this->getSoapBuilder();
$this->setExpectedException('InvalidArgumentException');
$builder->withWsdlCache('foo');
}
public function testWithSingleElementArrays()
{
$options = $this
->getSoapBuilder()
->withSingleElementArrays()
->getSoapOptions()
;
$this->assertEquals($this->mergeOptions(array('features' => SOAP_SINGLE_ELEMENT_ARRAYS)), $options);
}
public function testWithWaitOneWayCalls()
{
$options = $this
->getSoapBuilder()
->withWaitOneWayCalls()
->getSoapOptions()
;
$this->assertEquals($this->mergeOptions(array('features' => SOAP_WAIT_ONE_WAY_CALLS)), $options);
}
public function testWithUseXsiArrayType()
{
$options = $this
->getSoapBuilder()
->withUseXsiArrayType()
->getSoapOptions()
;
$this->assertEquals($this->mergeOptions(array('features' => SOAP_USE_XSI_ARRAY_TYPE)), $options);
}
public function testFeatures()
{
$builder = $this->getSoapBuilder();
$features = 0;
$builder->withSingleElementArrays();
$features |= SOAP_SINGLE_ELEMENT_ARRAYS;
$this->assertEquals($this->mergeOptions(array('features' => $features)), $builder->getSoapOptions());
$builder->withWaitOneWayCalls();
$features |= SOAP_WAIT_ONE_WAY_CALLS;
$this->assertEquals($this->mergeOptions(array('features' => $features)), $builder->getSoapOptions());
$builder->withUseXsiArrayType();
$features |= SOAP_USE_XSI_ARRAY_TYPE;
$this->assertEquals($this->mergeOptions(array('features' => $features)), $builder->getSoapOptions());
}
public function testWithTypeConverters()
{
$builder = $this->getSoapBuilder();
$builder->withTypeConverter(new DateTypeConverter());
$options = $builder->getSoapOptions();
$this->assertEquals(1, count($options['typemap']));
$converters = new TypeConverterCollection();
$converters->add(new DateTimeTypeConverter());
$builder->withTypeConverters($converters);
$options = $builder->getSoapOptions();
$this->assertEquals(2, count($options['typemap']));
$builder->withTypeConverters($converters, false);
$options = $builder->getSoapOptions();
$this->assertEquals(1, count($options['typemap']));
}
public function testClassmap()
{
$builder = $this->getSoapBuilder();
$builder->withClassMapping('foo', __CLASS__);
$options = $builder->getSoapOptions();
$this->assertEquals(1, count($options['classmap']));
$classmap = new ClassMap();
$classmap->add('bar', __CLASS__);
$builder->withClassmap($classmap);
$options = $builder->getSoapOptions();
$this->assertEquals(2, count($options['classmap']));
$builder->withClassmap($classmap, false);
$options = $builder->getSoapOptions();
$this->assertEquals(1, count($options['classmap']));
}
public function testCreateWithDefaults()
{
$builder = SoapBuilder::createWithDefaults();
$this->assertInstanceOf('BeSimple\SoapCommon\Tests\Fixtures\SoapBuilder', $builder);
$this->assertEquals($this->mergeOptions(array('soap_version' => SOAP_1_2, 'encoding' => 'UTF-8', 'features' => SOAP_SINGLE_ELEMENT_ARRAYS)), $builder->getSoapOptions());
}
private function getSoapBuilder()
{
return new SoapBuilder();
}
private function mergeOptions(array $options)
{
return array_merge($this->defaultOptions, $options);
}
}

View File

@ -16,7 +16,7 @@ use BeSimple\SoapCommon\Cache;
use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStream;
use org\bovigo\vfs\vfsStreamWrapper; use org\bovigo\vfs\vfsStreamWrapper;
class SoapRequestTest extends \PHPUnit_Framework_TestCase class CacheTest extends \PHPUnit_Framework_TestCase
{ {
public function testSetEnabled() public function testSetEnabled()
{ {

View File

@ -51,4 +51,3 @@ class DateTimeTypeConverterTest extends \PHPUnit_Framework_TestCase
$this->assertNull($date); $this->assertNull($date);
} }
} }

View File

@ -49,4 +49,3 @@ class DateTypeConverterTest extends \PHPUnit_Framework_TestCase
$this->assertNull($date); $this->assertNull($date);
} }
} }

View File

@ -30,19 +30,19 @@ class TypeConverterCollectionTest extends \PHPUnit_Framework_TestCase
$dateTimeTypeConverter = new DateTimeTypeConverter(); $dateTimeTypeConverter = new DateTimeTypeConverter();
$converters->add($dateTimeTypeConverter); $converters->add($dateTimeTypeConverter);
$this->assertSame(array($dateTimeTypeConverter), $converters->getAll()); $this->assertSame([$dateTimeTypeConverter], $converters->getAll());
$dateTypeConverter = new DateTypeConverter(); $dateTypeConverter = new DateTypeConverter();
$converters->add($dateTypeConverter); $converters->add($dateTypeConverter);
$this->assertSame(array($dateTimeTypeConverter, $dateTypeConverter), $converters->getAll()); $this->assertSame([$dateTimeTypeConverter, $dateTypeConverter], $converters->getAll());
} }
public function testGetTypemap() public function testGetTypemap()
{ {
$converters = new TypeConverterCollection(); $converters = new TypeConverterCollection();
$this->assertEquals(array(), $converters->getTypemap()); $this->assertEquals([], $converters->getTypemap());
$dateTimeTypeConverter = new DateTimeTypeConverter(); $dateTimeTypeConverter = new DateTimeTypeConverter();
$converters->add($dateTimeTypeConverter); $converters->add($dateTimeTypeConverter);
@ -70,7 +70,9 @@ class TypeConverterCollectionTest extends \PHPUnit_Framework_TestCase
$dateTimeTypeConverter = new DateTimeTypeConverter(); $dateTimeTypeConverter = new DateTimeTypeConverter();
$converters->add($dateTimeTypeConverter); $converters->add($dateTimeTypeConverter);
$converter = array(new DateTypeConverter); $converter = [
new DateTypeConverter()
];
$converters->set($converter); $converters->set($converter);
$this->assertSame($converter, $converters->getAll()); $this->assertSame($converter, $converters->getAll());
@ -85,7 +87,7 @@ class TypeConverterCollectionTest extends \PHPUnit_Framework_TestCase
$converters2->add($dateTimeTypeConverter); $converters2->add($dateTimeTypeConverter);
$converters1->addCollection($converters2); $converters1->addCollection($converters2);
$this->assertSame(array($dateTimeTypeConverter), $converters1->getAll()); $this->assertSame([$dateTimeTypeConverter], $converters1->getAll());
$this->setExpectedException('InvalidArgumentException'); $this->setExpectedException('InvalidArgumentException');
$converters1->addCollection($converters2); $converters1->addCollection($converters2);

View File

@ -137,7 +137,7 @@ class MultiPartTest extends \PHPUnit_Framework_TestCase
$withMain = array( $withMain = array(
trim($p1->getHeader('Content-ID'), '<>') => $p1, trim($p1->getHeader('Content-ID'), '<>') => $p1,
trim($p2->getHeader('Content-ID'),'<>') => $p2, trim($p2->getHeader('Content-ID'), '<>') => $p2
); );
$this->assertEquals($withMain, $mp->getParts(true)); $this->assertEquals($withMain, $mp->getParts(true));
} }

View File

@ -115,7 +115,8 @@ class ParserTest extends \PHPUnit_Framework_TestCase
$mimeMessage = file_get_contents($filename); $mimeMessage = file_get_contents($filename);
$headers = array( $headers = array(
'Content-Type' => 'multipart/related; type="application/xop+xml";start="<http://tempuri.org/0>";boundary="uuid:0ca0e16e-feb1-426c-97d8-c4508ada5e82+id=7";start-info="application/soap+xml"', 'Content-Type' =>
'multipart/related; type="application/xop+xml";start="<http://tempuri.org/0>";boundary="uuid:0ca0e16e-feb1-426c-97d8-c4508ada5e82+id=7";start-info="application/soap+xml"',
'Content-Length' => 1941, 'Content-Length' => 1941,
'Host' => '131.107.72.15', 'Host' => '131.107.72.15',
'Expect' => '100-continue', 'Expect' => '100-continue',

View File

@ -325,7 +325,6 @@ abstract class WsSecurityFilterClientServer
if (Helper::NS_WSS === $key->namespaceURI) { if (Helper::NS_WSS === $key->namespaceURI) {
switch ($key->localName) { switch ($key->localName) {
case 'KeyIdentifier': case 'KeyIdentifier':
return $this->serviceSecurityKey->getPublicKey(); return $this->serviceSecurityKey->getPublicKey();
case 'Reference': case 'Reference':
$uri = $key->getAttribute('URI'); $uri = $key->getAttribute('URI');
@ -336,7 +335,8 @@ abstract class WsSecurityFilterClientServer
$key = XmlSecurityEnc::decryptEncryptedKey($referencedNode, $this->userSecurityKey->getPrivateKey()); $key = XmlSecurityEnc::decryptEncryptedKey($referencedNode, $this->userSecurityKey->getPrivateKey());
return XmlSecurityKey::factory($algorithm, $key, false, XmlSecurityKey::TYPE_PRIVATE); return XmlSecurityKey::factory($algorithm, $key, false, XmlSecurityKey::TYPE_PRIVATE);
} elseif (Helper::NS_WSS === $referencedNode->namespaceURI }
if (Helper::NS_WSS === $referencedNode->namespaceURI
&& 'BinarySecurityToken' == $referencedNode->localName) { && 'BinarySecurityToken' == $referencedNode->localName) {
$key = XmlSecurityPem::formatKeyInPemFormat($referencedNode->textContent); $key = XmlSecurityPem::formatKeyInPemFormat($referencedNode->textContent);

View File

@ -1,26 +0,0 @@
<?php
/*
* This file is part of the BeSimpleSoapCommon.
*
* (c) Christian Kerl <christian-kerl@web.de>
* (c) Francis Besset <francis.besset@gmail.com>
* (c) Andreas Schamberger <mail@andreass.net>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace BeSimple\SoapServer\Exception;
/**
* ReceiverSoapFault send a "Receiver" fault code to client.
* This fault code is standardized: http://www.w3.org/TR/soap12-part1/#tabsoapfaultcodes
*/
class ReceiverSoapFault extends \SoapFault
{
public function __construct($faultstring, $faultactor = null, $detail = null, $faultname = null, $headerfault = null)
{
parent::__construct('Receiver', $faultstring, $faultactor, $detail, $faultname, $headerfault);
}
}

View File

@ -1,26 +0,0 @@
<?php
/*
* This file is part of the BeSimpleSoapCommon.
*
* (c) Christian Kerl <christian-kerl@web.de>
* (c) Francis Besset <francis.besset@gmail.com>
* (c) Andreas Schamberger <mail@andreass.net>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace BeSimple\SoapServer\Exception;
/**
* SenderSoapFault send a "Sender" fault code to client.
* This fault code is standardized: http://www.w3.org/TR/soap12-part1/#tabsoapfaultcodes
*/
class SenderSoapFault extends \SoapFault
{
public function __construct($faultstring, $faultactor = null, $detail = null, $faultname = null, $headerfault = null)
{
parent::__construct('Sender', $faultstring, $faultactor, $detail, $faultname, $headerfault);
}
}

View File

@ -21,6 +21,7 @@ class SoapServerOptions
private $handlerObject; private $handlerObject;
private $keepAlive; private $keepAlive;
private $errorReporting; private $errorReporting;
private $exceptions;
private $persistence; private $persistence;
/** /**
@ -47,19 +48,21 @@ class SoapServerOptions
public function getHandler() public function getHandler()
{ {
if ($this->hasHandlerObject() && $this->hasHandlerClass()) {
throw new Exception('Both HandlerClass and HandlerObject set: please specify only one');
}
if ($this->hasHandlerObject()) { if ($this->hasHandlerObject()) {
return $this->getHandlerObject(); return $this->getHandlerObject();
}
} else if ($this->hasHandlerClass()) { if ($this->hasHandlerClass()) {
return $this->getHandlerClass(); return $this->getHandlerClass();
}
} else {
throw new Exception('No HandlerClass or HandlerObject set'); throw new Exception('No HandlerClass or HandlerObject set');
} }
}
public function getHandlerInstance() public function getHandlerInstance()
{ {
@ -94,7 +97,7 @@ class SoapServerOptions
public function hasPersistence() public function hasPersistence()
{ {
return $this->persistence !== SoapServerOptions::SOAP_SERVER_PERSISTENCE_NONE; return $this->persistence !== self::SOAP_SERVER_PERSISTENCE_NONE;
} }
public function getPersistence() public function getPersistence()
@ -136,14 +139,13 @@ class SoapServerOptions
if (is_string($handler) && class_exists($handler)) { if (is_string($handler) && class_exists($handler)) {
return null; return null;
}
} elseif (is_object($handler)) { if (is_object($handler)) {
return $handler; return $handler;
} else {
throw new \InvalidArgumentException('The handler has to be a class name or an object');
} }
throw new \InvalidArgumentException('The handler has to be a class name or an object');
} }
/** /**
@ -155,13 +157,12 @@ class SoapServerOptions
if (is_string($handler) && class_exists($handler)) { if (is_string($handler) && class_exists($handler)) {
return $handler; return $handler;
}
} elseif (is_object($handler)) { if (is_object($handler)) {
return null; return null;
}
} else {
throw new \InvalidArgumentException('The handler has to be a class name or an object'); throw new \InvalidArgumentException('The handler has to be a class name or an object');
} }
} }
}

View File

@ -14,6 +14,7 @@ namespace BeSimple\SoapServer;
use BeSimple\SoapCommon\SoapOptions\SoapOptions; use BeSimple\SoapCommon\SoapOptions\SoapOptions;
use BeSimple\SoapServer\SoapOptions\SoapServerOptions; use BeSimple\SoapServer\SoapOptions\SoapServerOptions;
use Exception;
/** /**
* SoapServerBuilder provides a SoapServer instance from SoapServerOptions and SoapOptions. * SoapServerBuilder provides a SoapServer instance from SoapServerOptions and SoapOptions.
@ -40,9 +41,16 @@ class SoapServerBuilder
} }
if ($soapServerOptions->hasHandlerClass()) { if ($soapServerOptions->hasHandlerClass()) {
$server->setClass($soapServerOptions->getHandlerClass()); $server->setClass($soapServerOptions->getHandlerClass());
} else if ($soapServerOptions->hasHandlerObject()) { }
if ($soapServerOptions->hasHandlerObject()) {
$server->setObject($soapServerOptions->getHandlerObject()); $server->setObject($soapServerOptions->getHandlerObject());
} }
if ($soapServerOptions->hasHandlerClass() && $soapServerOptions->hasHandlerObject()) {
throw new Exception(
'Could not create SoapServer: HandlerClass and HandlerObject are set: please specify only one'
);
}
return $server; return $server;
} }

View File

@ -67,10 +67,11 @@ class WsSecurityFilter extends WsSecurityFilterClientServer implements SoapReque
* Modify the given request XML. * Modify the given request XML.
* *
* @param \BeSimple\SoapCommon\SoapRequest $request SOAP request * @param \BeSimple\SoapCommon\SoapRequest $request SOAP request
* @param int $attachmentType
* *
* @return void * @return void
*/ */
public function filterRequest(CommonSoapRequest $request) public function filterRequest(CommonSoapRequest $request, $attachmentType)
{ {
// get \DOMDocument from SOAP request // get \DOMDocument from SOAP request
$dom = $request->getContentDocument(); $dom = $request->getContentDocument();
@ -152,10 +153,11 @@ class WsSecurityFilter extends WsSecurityFilterClientServer implements SoapReque
* Modify the given request XML. * Modify the given request XML.
* *
* @param \BeSimple\SoapCommon\SoapResponse $response SOAP response * @param \BeSimple\SoapCommon\SoapResponse $response SOAP response
* @param int $attachmentType
* *
* @return void * @return void
*/ */
public function filterResponse(CommonSoapResponse $response) public function filterResponse(CommonSoapResponse $response, $attachmentType)
{ {
// get \DOMDocument from SOAP response // get \DOMDocument from SOAP response
$dom = $response->getContentDocument(); $dom = $response->getContentDocument();
@ -190,7 +192,7 @@ class WsSecurityFilter extends WsSecurityFilterClientServer implements SoapReque
} }
if (null !== $this->userSecurityKey && $this->userSecurityKey->hasKeys()) { if (null !== $this->userSecurityKey && $this->userSecurityKey->hasKeys()) {
$guid = 'CertId-' . Helper::generateUUID(); $guid = 'CertId-' . Helper::generateUuid();
// add token references // add token references
$keyInfo = null; $keyInfo = null;
if (null !== $this->tokenReferenceSignature) { if (null !== $this->tokenReferenceSignature) {
@ -216,7 +218,7 @@ class WsSecurityFilter extends WsSecurityFilterClientServer implements SoapReque
// encrypt soap document // encrypt soap document
if (null !== $this->serviceSecurityKey && $this->serviceSecurityKey->hasKeys()) { if (null !== $this->serviceSecurityKey && $this->serviceSecurityKey->hasKeys()) {
$guid = 'EncKey-' . Helper::generateUUID(); $guid = 'EncKey-' . Helper::generateUuid();
// add token references // add token references
$keyInfo = null; $keyInfo = null;
if (null !== $this->tokenReferenceEncryption) { if (null !== $this->tokenReferenceEncryption) {

View File

@ -9,7 +9,15 @@ class SoapFaultParserTest extends PHPUnit_Framework_TestCase
{ {
public function testParse() public function testParse()
{ {
$soapFaultXml = '<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>911</faultcode><faultstring>This is a dummy SoapFault.</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>'; $soapFaultXml = '<?xml version="1.0" encoding="UTF-8"?>'.
'<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">'.
'<SOAP-ENV:Body>'.
'<SOAP-ENV:Fault>'.
'<faultcode>911</faultcode>'.
'<faultstring>This is a dummy SoapFault.</faultstring>'.
'</SOAP-ENV:Fault>'.
'</SOAP-ENV:Body>'.
'</SOAP-ENV:Envelope>';
$soapFault = SoapFaultParser::parseSoapFault($soapFaultXml); $soapFault = SoapFaultParser::parseSoapFault($soapFaultXml);
self::assertInstanceOf(SoapFault::class, $soapFault); self::assertInstanceOf(SoapFault::class, $soapFault);