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

@ -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 $keepAlive;
private $errorReporting;
private $exceptions;
private $persistence;
/**
@ -47,18 +48,20 @@ class SoapServerOptions
public function getHandler()
{
if ($this->hasHandlerObject() && $this->hasHandlerClass()) {
throw new Exception('Both HandlerClass and HandlerObject set: please specify only one');
}
if ($this->hasHandlerObject()) {
return $this->getHandlerObject();
} else if ($this->hasHandlerClass()) {
}
if ($this->hasHandlerClass()) {
return $this->getHandlerClass();
} else {
throw new Exception('No HandlerClass or HandlerObject set');
}
throw new Exception('No HandlerClass or HandlerObject set');
}
public function getHandlerInstance()
@ -94,7 +97,7 @@ class SoapServerOptions
public function hasPersistence()
{
return $this->persistence !== SoapServerOptions::SOAP_SERVER_PERSISTENCE_NONE;
return $this->persistence !== self::SOAP_SERVER_PERSISTENCE_NONE;
}
public function getPersistence()
@ -136,14 +139,13 @@ class SoapServerOptions
if (is_string($handler) && class_exists($handler)) {
return null;
} elseif (is_object($handler)) {
}
if (is_object($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)) {
return $handler;
} elseif (is_object($handler)) {
}
if (is_object($handler)) {
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\SoapServer\SoapOptions\SoapServerOptions;
use Exception;
/**
* SoapServerBuilder provides a SoapServer instance from SoapServerOptions and SoapOptions.
@ -40,9 +41,16 @@ class SoapServerBuilder
}
if ($soapServerOptions->hasHandlerClass()) {
$server->setClass($soapServerOptions->getHandlerClass());
} else if ($soapServerOptions->hasHandlerObject()) {
}
if ($soapServerOptions->hasHandlerObject()) {
$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;
}

View File

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