From 6af0639c92aaf07567d9cdd874ba2d6dfb0eb20c Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Fri, 9 Jan 2004 14:56:24 +0000 Subject: [PATCH] Tests were improved (https:// support) --- ext/soap/interop/client_round2_interop.php | 21 +++++++++++++-------- ext/soap/interop/client_round2_params.php | 10 +++++++--- ext/soap/interop/echoheadersvc.wsdl.php | 2 +- ext/soap/interop/index.php | 8 ++++---- ext/soap/interop/interop.wsdl.php | 2 +- ext/soap/interop/server_round2_base.php | 2 +- ext/soap/interop/server_round2_groupB.php | 2 +- ext/soap/interop/test.utility.php | 5 +++++ 8 files changed, 33 insertions(+), 19 deletions(-) diff --git a/ext/soap/interop/client_round2_interop.php b/ext/soap/interop/client_round2_interop.php index 6c4dbd6499..7d981b33d2 100644 --- a/ext/soap/interop/client_round2_interop.php +++ b/ext/soap/interop/client_round2_interop.php @@ -71,18 +71,18 @@ class Interop_Client // set up local endpoint $this->localEndpoint['base'] = (object)array( 'endpointName'=>'PHP ext/soap', - 'endpointURL'=>'http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).'/server_round2_base.php', - 'wsdlURL'=>'http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).'/interop.wsdl.php' + 'endpointURL'=>'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/server_round2_base.php', + 'wsdlURL'=>'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/interop.wsdl.php' ); $this->localEndpoint['GroupB'] = (object)array( 'endpointName'=>'PHP ext/soap', - 'endpointURL'=>'http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).'/server_round2_groupB.php', - 'wsdlURL'=>'http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).'/interopB.wsdl.php' + 'endpointURL'=>'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/server_round2_groupB.php', + 'wsdlURL'=>'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/interopB.wsdl.php' ); $this->localEndpoint['GroupC'] = (object)array( 'endpointName'=>'PHP ext/soap', - 'endpointURL'=>'http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).'/server_round2_groupC.php', - 'wsdlURL'=>'http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).'/echoheadersvc.wsdl.php' + 'endpointURL'=>'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/server_round2_groupC.php', + 'wsdlURL'=>'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/echoheadersvc.wsdl.php' ); } @@ -481,9 +481,14 @@ class Interop_Client // compare the results with what we sent - $ok = $this->compareResult($sent_d,$return, $sent->type); - if (!$ok && $soap_test->expect) { + if ($soap_test->cmp_func !== NULL) { + $cmp_func = $soap_test->cmp_func; + $ok = $cmp_func($sent_d,$return); + } else { + $ok = $this->compareResult($sent_d,$return, $sent->type); + if (!$ok && $soap_test->expect) { $ok = $this->compareResult($soap_test->expect,$return); + } } // save the wire diff --git a/ext/soap/interop/client_round2_params.php b/ext/soap/interop/client_round2_params.php index b78fb14bce..c7a8245924 100644 --- a/ext/soap/interop/client_round2_params.php +++ b/ext/soap/interop/client_round2_params.php @@ -27,6 +27,7 @@ class SOAP_Test { var $test_name = NULL; var $method_name = NULL; var $method_params = NULL; + var $cmp_func = NULL; var $expect = NULL; var $expect_fault = FALSE; var $headers = NULL; @@ -36,7 +37,7 @@ class SOAP_Test { var $debug = 0; var $encoding = 'UTF-8'; - function SOAP_Test($methodname, $params, $expect = NULL) { + function SOAP_Test($methodname, $params, $expect = NULL, $cmp_func = NULL) { # XXX we have to do this to make php-soap happy with NULL params if (!$params) $params = array(); @@ -51,6 +52,9 @@ class SOAP_Test { if ($expect !== NULL) { $this->expect = $expect; } + if ($cmp_func !== NULL) { + $this->cmp_func = $cmp_func; + } // determine test type if ($params) { @@ -259,9 +263,9 @@ $soap_tests['base'][] = new SOAP_Test('echoBase64', array('inputBase64' => //*********************************************************** // Base echoHexBinary -$soap_tests['base'][] = new SOAP_Test('echoHexBinary', array('inputHexBinary' => '736F61707834')); +$soap_tests['base'][] = new SOAP_Test('echoHexBinary', array('inputHexBinary' => '736F61707834'),'736F61707834','hex_compare'); $soap_tests['base'][] = new SOAP_Test('echoHexBinary', array('inputHexBinary' => - soap_value('inputHexBinary','736F61707834',XSD_HEXBINARY))); + soap_value('inputHexBinary','736F61707834',XSD_HEXBINARY)),'736F61707834','hex_compare'); //*********************************************************** // Base echoDecimal diff --git a/ext/soap/interop/echoheadersvc.wsdl.php b/ext/soap/interop/echoheadersvc.wsdl.php index 2eb5c8c6e1..b310960657 100644 --- a/ext/soap/interop/echoheadersvc.wsdl.php +++ b/ext/soap/interop/echoheadersvc.wsdl.php @@ -12,7 +12,7 @@ echo "\n"; - + /server_round2.php"/> diff --git a/ext/soap/interop/index.php b/ext/soap/interop/index.php index 7c63ebf79f..999cd47efa 100644 --- a/ext/soap/interop/index.php +++ b/ext/soap/interop/index.php @@ -6,10 +6,10 @@ diff --git a/ext/soap/interop/interop.wsdl.php b/ext/soap/interop/interop.wsdl.php index e71a19c76d..b257c56b66 100644 --- a/ext/soap/interop/interop.wsdl.php +++ b/ext/soap/interop/interop.wsdl.php @@ -328,7 +328,7 @@ echo "\n"; - + /server_round2_base.php"/> diff --git a/ext/soap/interop/server_round2_base.php b/ext/soap/interop/server_round2_base.php index 314a5c85e2..0c6771d88e 100644 --- a/ext/soap/interop/server_round2_base.php +++ b/ext/soap/interop/server_round2_base.php @@ -139,7 +139,7 @@ class SOAP_Interop_Base { } $server = new SoapServer("http://test-uri"); -$server->bind("http://".$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF'])."/interop.wsdl.php"); +$server->bind((isset($_SERVER['HTTPS'])?"https://":"http://").$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/interop.wsdl.php"); $server->setClass("SOAP_Interop_Base"); $server->handle(); ?> \ No newline at end of file diff --git a/ext/soap/interop/server_round2_groupB.php b/ext/soap/interop/server_round2_groupB.php index dc36aa5027..eaae5ba89b 100644 --- a/ext/soap/interop/server_round2_groupB.php +++ b/ext/soap/interop/server_round2_groupB.php @@ -64,7 +64,7 @@ class SOAP_Interop_GroupB { } $server = new SoapServer("http://test-uri"); -$server->bind("http://".$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF'])."/interopB.wsdl.php"); +$server->bind((isset($_SERVER['HTTPS'])?"https://":"http://").$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/interopB.wsdl.php"); $server->setClass("SOAP_Interop_GroupB"); $server->handle(); ?> \ No newline at end of file diff --git a/ext/soap/interop/test.utility.php b/ext/soap/interop/test.utility.php index bfe176dc93..50f85f1cd8 100644 --- a/ext/soap/interop/test.utility.php +++ b/ext/soap/interop/test.utility.php @@ -1,5 +1,10 @@