From 7f96a20f6671d282a40d9b0683775d8804b2df14 Mon Sep 17 00:00:00 2001 From: Andreas Schamberger Date: Sun, 15 Jan 2012 11:42:21 +0100 Subject: [PATCH] Several WS and CS fixes --- src/BeSimple/SoapClient/Curl.php | 4 +-- src/BeSimple/SoapClient/SoapClient.php | 2 +- src/BeSimple/SoapClient/SoapClientBuilder.php | 1 + tests/AxisInterop/MTOM.php | 16 +++++++++- tests/AxisInterop/SwA.php | 2 -- tests/AxisInterop/WsAddressing.php | 2 -- tests/AxisInterop/WsSecurityUserPass.php | 2 -- tests/BeSimple/Tests/SoapClient/CurlTest.php | 7 +++-- .../Tests/SoapClient/WsdlDownloaderTest.php | 29 ++++++++++--------- 9 files changed, 38 insertions(+), 27 deletions(-) diff --git a/src/BeSimple/SoapClient/Curl.php b/src/BeSimple/SoapClient/Curl.php index ae57933..54e40cf 100644 --- a/src/BeSimple/SoapClient/Curl.php +++ b/src/BeSimple/SoapClient/Curl.php @@ -72,7 +72,7 @@ class Curl CURLOPT_HEADER => true, CURLOPT_USERAGENT => $options['user_agent'], CURLINFO_HEADER_OUT => true, - ); + ); curl_setopt_array($this->ch, $curlOptions); if (isset($options['compression']) && !($options['compression'] & SOAP_COMPRESSION_ACCEPT)) { curl_setopt($this->ch, CURLOPT_ENCODING, 'identity'); @@ -215,7 +215,7 @@ class Curl 67 => 'Could not connect to host', //CURLE_LOGIN_DENIED 77 => 'Could not connect to host', //CURLE_SSL_CACERT_BADFILE 80 => 'Error Fetching http body, No Content-Length, connection closed or chunked data', //CURLE_SSL_SHUTDOWN_FAILED - ); + ); } /** diff --git a/src/BeSimple/SoapClient/SoapClient.php b/src/BeSimple/SoapClient/SoapClient.php index 90d8f1d..c5b9117 100644 --- a/src/BeSimple/SoapClient/SoapClient.php +++ b/src/BeSimple/SoapClient/SoapClient.php @@ -77,7 +77,7 @@ class SoapClient extends \SoapClient private $lastResponse = ''; /** - * Last response. + * Soap kernel. * * @var \BeSimple\SoapCommon\SoapKernel */ diff --git a/src/BeSimple/SoapClient/SoapClientBuilder.php b/src/BeSimple/SoapClient/SoapClientBuilder.php index 3759f13..b2ceb61 100644 --- a/src/BeSimple/SoapClient/SoapClientBuilder.php +++ b/src/BeSimple/SoapClient/SoapClientBuilder.php @@ -13,6 +13,7 @@ namespace BeSimple\SoapClient; use BeSimple\SoapCommon\AbstractSoapBuilder; +use BeSimple\SoapCommon\Helper; /** * Fluent interface builder for SoapClient instance. diff --git a/tests/AxisInterop/MTOM.php b/tests/AxisInterop/MTOM.php index cbfe886..8f091bc 100644 --- a/tests/AxisInterop/MTOM.php +++ b/tests/AxisInterop/MTOM.php @@ -5,7 +5,21 @@ use BeSimple\SoapClient\SoapClient as BeSimpleSoapClient; require '../bootstrap.php'; -echo '
';
+class base64Binary
+{
+    public $_;
+    public $contentType;
+}
+
+class AttachmentType
+{
+    public $fileName;
+    public $binaryData;
+}
+
+class AttachmentRequest extends AttachmentType
+{
+}
 
 $options = array(
     'soap_version'    => SOAP_1_1,
diff --git a/tests/AxisInterop/SwA.php b/tests/AxisInterop/SwA.php
index 0cf5b77..eaf1bc6 100644
--- a/tests/AxisInterop/SwA.php
+++ b/tests/AxisInterop/SwA.php
@@ -5,8 +5,6 @@ use BeSimple\SoapClient\SoapClient as BeSimpleSoapClient;
 
 require '../bootstrap.php';
 
-echo '
';
-
 $options = array(
     'soap_version'    => SOAP_1_1,
     'features'        => SOAP_SINGLE_ELEMENT_ARRAYS, // make sure that result is array for size=1
diff --git a/tests/AxisInterop/WsAddressing.php b/tests/AxisInterop/WsAddressing.php
index 9ec1bcc..dacabcb 100644
--- a/tests/AxisInterop/WsAddressing.php
+++ b/tests/AxisInterop/WsAddressing.php
@@ -5,8 +5,6 @@ use BeSimple\SoapClient\WsAddressingFilter as BeSimpleWsAddressingFilter;
 
 require '../bootstrap.php';
 
-echo '
';
-
 $options = array(
     'soap_version' => SOAP_1_2,
     'features'     => SOAP_SINGLE_ELEMENT_ARRAYS, // make sure that result is array for size=1
diff --git a/tests/AxisInterop/WsSecurityUserPass.php b/tests/AxisInterop/WsSecurityUserPass.php
index 595d9ba..231f1e5 100644
--- a/tests/AxisInterop/WsSecurityUserPass.php
+++ b/tests/AxisInterop/WsSecurityUserPass.php
@@ -5,8 +5,6 @@ use BeSimple\SoapClient\WsSecurityFilter as BeSimpleWsSecurityFilter;
 
 require '../bootstrap.php';
 
-echo '
';
-
 $options = array(
     'soap_version' => SOAP_1_2,
     'features'     => SOAP_SINGLE_ELEMENT_ARRAYS, // make sure that result is array for size=1
diff --git a/tests/BeSimple/Tests/SoapClient/CurlTest.php b/tests/BeSimple/Tests/SoapClient/CurlTest.php
index b940b2a..d669f4c 100644
--- a/tests/BeSimple/Tests/SoapClient/CurlTest.php
+++ b/tests/BeSimple/Tests/SoapClient/CurlTest.php
@@ -23,11 +23,12 @@ class CurlTest extends \PHPUnit_Framework_TestCase
 
     protected function startPhpWebserver()
     {
-        if ('Windows' == substr(php_uname('s'), 0, 7 )) {
-            $powershellCommand = "\$app = start-process php.exe -ArgumentList '-S localhost:8000 -t ".__DIR__.DIRECTORY_SEPARATOR."Fixtures' -WindowStyle 'Hidden' -passthru; Echo \$app.Id;";
+            $dir = __DIR__.DIRECTORY_SEPARATOR.'Fixtures';
+        if ('Windows' == substr(php_uname('s'), 0, 7)) {
+            $powershellCommand = "\$app = start-process php.exe -ArgumentList '-S localhost:8000 -t ".$dir."' -WindowStyle 'Hidden' -passthru; Echo \$app.Id;";
             $shellCommand = 'powershell -command "& {'.$powershellCommand.'}"';
         } else {
-            $shellCommand = "nohup php -S localhost:8000 -t ".__DIR__.DIRECTORY_SEPARATOR."Fixtures &";
+            $shellCommand = "nohup php -S localhost:8000 -t ".$dir." &";
         }
         $output = array();
         exec($shellCommand, $output);
diff --git a/tests/BeSimple/Tests/SoapClient/WsdlDownloaderTest.php b/tests/BeSimple/Tests/SoapClient/WsdlDownloaderTest.php
index 14ac58a..198341d 100644
--- a/tests/BeSimple/Tests/SoapClient/WsdlDownloaderTest.php
+++ b/tests/BeSimple/Tests/SoapClient/WsdlDownloaderTest.php
@@ -24,11 +24,12 @@ class WsdlDownloaderTest extends \PHPUnit_Framework_TestCase
 
     protected function startPhpWebserver()
     {
-        if ('Windows' == substr(php_uname('s'), 0, 7 )) {
-            $powershellCommand = "\$app = start-process php.exe -ArgumentList '-S localhost:8000 -t ".__DIR__.DIRECTORY_SEPARATOR."Fixtures' -WindowStyle 'Hidden' -passthru; Echo \$app.Id;";
+        $dir = __DIR__.DIRECTORY_SEPARATOR.'Fixtures';
+        if ('Windows' == substr(php_uname('s'), 0, 7)) {
+            $powershellCommand = "\$app = start-process php.exe -ArgumentList '-S localhost:8000 -t ".$dir."' -WindowStyle 'Hidden' -passthru; Echo \$app.Id;";
             $shellCommand = 'powershell -command "& {'.$powershellCommand.'}"';
         } else {
-            $shellCommand = "nohup php -S localhost:8000 -t ".__DIR__.DIRECTORY_SEPARATOR."Fixtures &";
+            $shellCommand = "nohup php -S localhost:8000 -t ".$dir." &";
         }
         $output = array();
         exec($shellCommand, $output);
@@ -38,7 +39,7 @@ class WsdlDownloaderTest extends \PHPUnit_Framework_TestCase
     protected function stopPhpWebserver()
     {
         if (!is_null($this->webserverProcessId)) {
-            if ('Windows' == substr(php_uname('s'), 0, 7 )) {
+            if ('Windows' == substr(php_uname('s'), 0, 7)) {
                 exec('TASKKILL /F /PID ' . $this->webserverProcessId);
             } else {
                 exec('kill ' . $this->webserverProcessId);
@@ -57,7 +58,7 @@ class WsdlDownloaderTest extends \PHPUnit_Framework_TestCase
         $cacheDir = ini_get('soap.wsdl_cache_dir');
         if (!is_dir($cacheDir)) {
             $cacheDir = sys_get_temp_dir();
-            $cacheDirForRegExp = preg_quote( $cacheDir );
+            $cacheDirForRegExp = preg_quote($cacheDir);
         }
 
         $tests = array(
@@ -82,7 +83,7 @@ class WsdlDownloaderTest extends \PHPUnit_Framework_TestCase
         foreach ($tests as $name => $values) {
             $cacheFileName = $wd->download($values['source']);
             $result = file_get_contents($cacheFileName);
-            $this->assertRegExp($values['assertRegExp'],$result,$name);
+            $this->assertRegExp($values['assertRegExp'], $result, $name);
             unlink($cacheFileName);
         }
 
@@ -129,7 +130,7 @@ class WsdlDownloaderTest extends \PHPUnit_Framework_TestCase
         $cacheDir = ini_get('soap.wsdl_cache_dir');
         if (!is_dir($cacheDir)) {
             $cacheDir = sys_get_temp_dir();
-            $cacheDirForRegExp = preg_quote( $cacheDir );
+            $cacheDirForRegExp = preg_quote($cacheDir);
         }
 
         $remoteUrlAbsolute = 'http://localhost:8000/wsdlinclude/wsdlinctest_absolute.xml';
@@ -162,10 +163,10 @@ class WsdlDownloaderTest extends \PHPUnit_Framework_TestCase
         );
 
         foreach ($tests as $name => $values) {
-            $wsdl = file_get_contents( $values['source'] );
-            $method->invoke($wd, $wsdl, $values['cacheFile'],$values['remoteParentUrl']);
+            $wsdl = file_get_contents($values['source']);
+            $method->invoke($wd, $wsdl, $values['cacheFile'], $values['remoteParentUrl']);
             $result = file_get_contents($values['cacheFile']);
-            $this->assertRegExp($values['assertRegExp'],$result,$name);
+            $this->assertRegExp($values['assertRegExp'], $result, $name);
             unlink($values['cacheFile']);
         }
 
@@ -186,7 +187,7 @@ class WsdlDownloaderTest extends \PHPUnit_Framework_TestCase
         $cacheDir = ini_get('soap.wsdl_cache_dir');
         if (!is_dir($cacheDir)) {
             $cacheDir = sys_get_temp_dir();
-            $cacheDirForRegExp = preg_quote( $cacheDir );
+            $cacheDirForRegExp = preg_quote($cacheDir);
         }
 
         $remoteUrlAbsolute = 'http://localhost:8000/xsdinclude/xsdinctest_absolute.xml';
@@ -219,10 +220,10 @@ class WsdlDownloaderTest extends \PHPUnit_Framework_TestCase
         );
 
         foreach ($tests as $name => $values) {
-            $wsdl = file_get_contents( $values['source'] );
-            $method->invoke($wd, $wsdl, $values['cacheFile'],$values['remoteParentUrl']);
+            $wsdl = file_get_contents($values['source']);
+            $method->invoke($wd, $wsdl, $values['cacheFile'], $values['remoteParentUrl']);
             $result = file_get_contents($values['cacheFile']);
-            $this->assertRegExp($values['assertRegExp'],$result,$name);
+            $this->assertRegExp($values['assertRegExp'], $result, $name);
             unlink($values['cacheFile']);
         }