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

@ -120,7 +120,7 @@ class Curl
$httpAuthenticationBasic = $options->getHttpAuthentication();
curl_setopt($curlSession, CURLOPT_HTTPAUTH, $httpAuthenticationBasic->getAuthenticationType());
curl_setopt($curlSession, CURLOPT_USERPWD, $httpAuthenticationBasic->getUsername() . ':' . $httpAuthenticationBasic->getPassword());
} else if ($options->hasHttpAuthenticationDigest()) {
} elseif ($options->hasHttpAuthenticationDigest()) {
/** @var HttpAuthenticationDigestOptions $httpAuthenticationDigest */
$httpAuthenticationDigest = $options->getHttpAuthentication();
curl_setopt($curlSession, CURLOPT_HTTPAUTH, $httpAuthenticationDigest->getAuthenticationType());

View File

@ -50,13 +50,14 @@ class CurlOptionsBuilder
$basicAuthentication->getPassword()
);
} else if ($soapClientOptions->hasAuthenticationDigest()) {
}
if ($soapClientOptions->hasAuthenticationDigest()) {
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;

View File

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

View File

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

View File

@ -94,16 +94,16 @@ class WsAddressingFilter implements SoapRequestFilter, SoapResponseFilter
/**
* 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.
*
* @var unknown_type
* @var array
*/
protected $referenceParametersRecieved = array();
protected $referenceParametersRecieved;
/**
* RelatesTo.
@ -214,7 +214,7 @@ class WsAddressingFilter implements SoapRequestFilter, SoapResponseFilter
public function setMessageId($messageId = null)
{
if (null === $messageId) {
$messageId = 'uuid:' . Helper::generateUUID();
$messageId = 'uuid:' . Helper::generateUuid();
}
$this->messageId = $messageId;
}
@ -259,7 +259,7 @@ class WsAddressingFilter implements SoapRequestFilter, SoapResponseFilter
*
* @return void
*/
public function filterRequest(CommonSoapRequest $request)
public function filterRequest(CommonSoapRequest $request, $attachmentType)
{
// get \DOMDocument from SOAP request
$dom = $request->getContentDocument();
@ -328,7 +328,7 @@ class WsAddressingFilter implements SoapRequestFilter, SoapResponseFilter
*
* @return void
*/
public function filterResponse(CommonSoapResponse $response)
public function filterResponse(CommonSoapResponse $response, $attachmentType)
{
// get \DOMDocument from SOAP response
$dom = $response->getContentDocument();
@ -344,4 +344,4 @@ class WsAddressingFilter implements SoapRequestFilter, SoapResponseFilter
}
}
}
}
}

View File

@ -104,10 +104,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();
@ -174,7 +175,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) {
@ -200,7 +201,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) {
@ -226,10 +227,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();

View File

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