mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
Import from DCARF SVN
This commit is contained in:
58
include/pear/tests/XML_RPC/tests/allgot.inc
Normal file
58
include/pear/tests/XML_RPC/tests/allgot.inc
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* LICENSE: This source file is subject to version 3.01 of the PHP license
|
||||
* that is available through the world-wide-web at the following URI:
|
||||
* http://www.php.net/license/3_01.txt. If you did not receive a copy of
|
||||
* the PHP License and are unable to obtain it through the web, please
|
||||
* send a note to license@php.net so we can mail you a copy immediately.
|
||||
*
|
||||
* @category Web Services
|
||||
* @package XML_RPC
|
||||
* @author Daniel Convissor <danielc@php.net>
|
||||
* @copyright 2005-2006 The PHP Group
|
||||
* @license http://www.php.net/license/3_01.txt PHP License
|
||||
* @version CVS: $Id: allgot.inc,v 1.2 2006/06/11 00:25:17 danielc Exp $
|
||||
* @link http://pear.php.net/package/XML_RPC
|
||||
* @since File available since Release 1.4.4
|
||||
*/
|
||||
|
||||
ob_start();
|
||||
|
||||
function returnAllGot($params) {
|
||||
$out = '';
|
||||
$count = count($params->params);
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$param = $params->getParam($i);
|
||||
if (!XML_RPC_Value::isValue($param)) {
|
||||
$out .= "parameter $i was error: $param\n";
|
||||
continue;
|
||||
}
|
||||
$got = XML_RPC_Decode($param);
|
||||
$out .= "param $i: " . var_export($got, true) . "\n";
|
||||
}
|
||||
$val = new XML_RPC_Value($out, 'string');
|
||||
return new XML_RPC_Response($val);
|
||||
}
|
||||
|
||||
$server = new XML_RPC_Server(
|
||||
array(
|
||||
'allgot' => array(
|
||||
'function' => 'returnAllGot',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
$got = ob_get_clean();
|
||||
|
||||
if ($got == $expect) {
|
||||
echo "passed\n";
|
||||
} else {
|
||||
echo "FAILED\n";
|
||||
echo "Expected:\n$expect\n";
|
||||
echo "Got:\n$got\n";
|
||||
}
|
||||
90
include/pear/tests/XML_RPC/tests/empty-value-struct.php
Normal file
90
include/pear/tests/XML_RPC/tests/empty-value-struct.php
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Tests how the XML_RPC server handles a parameter with an empty struct without
|
||||
* any spaces in the XML after the empty value.
|
||||
*
|
||||
* If you are running this test from a CVS checkout, you must rename the working
|
||||
* directory from "XML_RPC" to "XML".
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* LICENSE: This source file is subject to version 3.0 of the PHP license
|
||||
* that is available through the world-wide-web at the following URI:
|
||||
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
|
||||
* the PHP License and are unable to obtain it through the web, please
|
||||
* send a note to license@php.net so we can mail you a copy immediately.
|
||||
*
|
||||
* @category Web Services
|
||||
* @package XML_RPC
|
||||
* @author Daniel Convissor <danielc@php.net>
|
||||
* @copyright 2005-2006 The PHP Group
|
||||
* @license http://www.php.net/license/3_0.txt PHP License
|
||||
* @version CVS: $Id: empty-value-struct.php,v 1.2 2006/06/11 00:25:17 danielc Exp $
|
||||
* @link http://pear.php.net/package/XML_RPC
|
||||
* @since File available since Release 1.4.4
|
||||
*/
|
||||
|
||||
/*
|
||||
* If the package version number is found in the left hand
|
||||
* portion of the if() expression below, that means this file has
|
||||
* come from the PEAR installer. Therefore, let's test the
|
||||
* installed version of XML_RPC which should be in the include path.
|
||||
*
|
||||
* If the version has not been substituted in the if() expression,
|
||||
* this file has likely come from a CVS checkout or a .tar file.
|
||||
* Therefore, we'll assume the tests should use the version of
|
||||
* XML_RPC that has come from there as well.
|
||||
*/
|
||||
if ('1.5.1' != '@'.'package_version'.'@') {
|
||||
/**
|
||||
* Get the needed class from the PEAR installation
|
||||
*/
|
||||
require_once 'XML/RPC/Server.php';
|
||||
} else {
|
||||
if (substr(dirname(__FILE__), -9, -6) != 'XML') {
|
||||
echo "The parent directory must be named 'XML'.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
ini_set('include_path', '../../'
|
||||
. PATH_SEPARATOR . '.' . PATH_SEPARATOR
|
||||
. ini_get('include_path')
|
||||
);
|
||||
|
||||
/**
|
||||
* Get the needed class from the parent directory
|
||||
*/
|
||||
require_once '../Server.php';
|
||||
}
|
||||
|
||||
$GLOBALS['HTTP_RAW_POST_DATA'] = <<<EOPOST
|
||||
<?xml version="1.0"?>
|
||||
<methodCall>
|
||||
<methodName>allgot</methodName>
|
||||
<params>
|
||||
<param>
|
||||
<value>
|
||||
<struct>
|
||||
<member>
|
||||
<name>fld1</name><value></value></member></struct></value>
|
||||
</param>
|
||||
</params>
|
||||
</methodCall>
|
||||
EOPOST;
|
||||
|
||||
$expect = <<<EOEXP
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<methodResponse>
|
||||
<params>
|
||||
<param>
|
||||
<value><string>param 0: array (
|
||||
'fld1' => '',
|
||||
)
|
||||
</string></value>
|
||||
</param>
|
||||
</params>
|
||||
</methodResponse>
|
||||
EOEXP;
|
||||
|
||||
include './allgot.inc';
|
||||
88
include/pear/tests/XML_RPC/tests/empty-value.php
Normal file
88
include/pear/tests/XML_RPC/tests/empty-value.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Tests how the XML_RPC server handles parameters with empty values.
|
||||
*
|
||||
* If you are running this test from a CVS checkout, you must rename the working
|
||||
* directory from "XML_RPC" to "XML".
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* LICENSE: This source file is subject to version 3.01 of the PHP license
|
||||
* that is available through the world-wide-web at the following URI:
|
||||
* http://www.php.net/license/3_01.txt. If you did not receive a copy of
|
||||
* the PHP License and are unable to obtain it through the web, please
|
||||
* send a note to license@php.net so we can mail you a copy immediately.
|
||||
*
|
||||
* @category Web Services
|
||||
* @package XML_RPC
|
||||
* @author Daniel Convissor <danielc@php.net>
|
||||
* @copyright 2005-2006 The PHP Group
|
||||
* @license http://www.php.net/license/3_01.txt PHP License
|
||||
* @version CVS: $Id: empty-value.php,v 1.2 2006/06/11 00:25:17 danielc Exp $
|
||||
* @link http://pear.php.net/package/XML_RPC
|
||||
* @since File available since Release 1.4.4
|
||||
*/
|
||||
|
||||
/*
|
||||
* If the package version number is found in the left hand
|
||||
* portion of the if() expression below, that means this file has
|
||||
* come from the PEAR installer. Therefore, let's test the
|
||||
* installed version of XML_RPC which should be in the include path.
|
||||
*
|
||||
* If the version has not been substituted in the if() expression,
|
||||
* this file has likely come from a CVS checkout or a .tar file.
|
||||
* Therefore, we'll assume the tests should use the version of
|
||||
* XML_RPC that has come from there as well.
|
||||
*/
|
||||
if ('1.5.1' != '@'.'package_version'.'@') {
|
||||
/**
|
||||
* Get the needed class from the PEAR installation
|
||||
*/
|
||||
require_once 'XML/RPC/Server.php';
|
||||
} else {
|
||||
if (substr(dirname(__FILE__), -9, -6) != 'XML') {
|
||||
echo "The parent directory must be named 'XML'.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
ini_set('include_path', '../../'
|
||||
. PATH_SEPARATOR . '.' . PATH_SEPARATOR
|
||||
. ini_get('include_path')
|
||||
);
|
||||
|
||||
/**
|
||||
* Get the needed class from the parent directory
|
||||
*/
|
||||
require_once '../Server.php';
|
||||
}
|
||||
|
||||
$GLOBALS['HTTP_RAW_POST_DATA'] = <<<EOPOST
|
||||
<?xml version="1.0"?>
|
||||
<methodCall>
|
||||
<methodName>allgot</methodName>
|
||||
<params>
|
||||
<param><value><string></string></value></param>
|
||||
<param><value>first</value></param>
|
||||
<param><value> </value></param>
|
||||
<param><value></value></param>
|
||||
</params>
|
||||
</methodCall>
|
||||
EOPOST;
|
||||
|
||||
$expect = <<<EOEXP
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<methodResponse>
|
||||
<params>
|
||||
<param>
|
||||
<value><string>param 0: ''
|
||||
param 1: 'first'
|
||||
param 2: ' '
|
||||
param 3: ''
|
||||
</string></value>
|
||||
</param>
|
||||
</params>
|
||||
</methodResponse>
|
||||
EOEXP;
|
||||
|
||||
include './allgot.inc';
|
||||
109
include/pear/tests/XML_RPC/tests/extra-lines.php
Normal file
109
include/pear/tests/XML_RPC/tests/extra-lines.php
Normal file
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Tests how the XML_RPC server handles parameters with empty values.
|
||||
*
|
||||
* If you are running this test from a CVS checkout, you must rename the working
|
||||
* directory from "XML_RPC" to "XML".
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* LICENSE: This source file is subject to version 3.01 of the PHP license
|
||||
* that is available through the world-wide-web at the following URI:
|
||||
* http://www.php.net/license/3_01.txt. If you did not receive a copy of
|
||||
* the PHP License and are unable to obtain it through the web, please
|
||||
* send a note to license@php.net so we can mail you a copy immediately.
|
||||
*
|
||||
* @category Web Services
|
||||
* @package XML_RPC
|
||||
* @author Daniel Convissor <danielc@php.net>
|
||||
* @copyright 2005-2006 The PHP Group
|
||||
* @license http://www.php.net/license/3_01.txt PHP License
|
||||
* @version CVS: $Id: extra-lines.php,v 1.2 2006/06/11 00:25:17 danielc Exp $
|
||||
* @link http://pear.php.net/package/XML_RPC
|
||||
* @since File available since Release 1.4.4
|
||||
*/
|
||||
|
||||
/*
|
||||
* If the package version number is found in the left hand
|
||||
* portion of the if() expression below, that means this file has
|
||||
* come from the PEAR installer. Therefore, let's test the
|
||||
* installed version of XML_RPC which should be in the include path.
|
||||
*
|
||||
* If the version has not been substituted in the if() expression,
|
||||
* this file has likely come from a CVS checkout or a .tar file.
|
||||
* Therefore, we'll assume the tests should use the version of
|
||||
* XML_RPC that has come from there as well.
|
||||
*/
|
||||
if ('1.5.1' != '@'.'package_version'.'@') {
|
||||
/**
|
||||
* Get the needed class from the PEAR installation
|
||||
*/
|
||||
require_once 'XML/RPC.php';
|
||||
} else {
|
||||
if (substr(dirname(__FILE__), -9, -6) != 'XML') {
|
||||
echo "The parent directory must be named 'XML'.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
ini_set('include_path', '../../'
|
||||
. PATH_SEPARATOR . '.' . PATH_SEPARATOR
|
||||
. ini_get('include_path')
|
||||
);
|
||||
|
||||
/**
|
||||
* Get the needed class from the parent directory
|
||||
*/
|
||||
require_once '../RPC.php';
|
||||
}
|
||||
|
||||
$input = "First lfs\n\nSecond crlfs\r\n\r\nThird crs\r\rFourth line";
|
||||
|
||||
$expect_removed = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<methodCall>
|
||||
<methodName>nada</methodName>
|
||||
<params>
|
||||
<param>
|
||||
<value><string>First lfs
|
||||
Second crlfs
|
||||
Third crs
|
||||
Fourth line</string></value>
|
||||
</param>
|
||||
</params>
|
||||
</methodCall>
|
||||
";
|
||||
|
||||
$expect_not_removed = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<methodCall>
|
||||
<methodName>nada</methodName>
|
||||
<params>
|
||||
<param>
|
||||
<value><string>First lfs
|
||||
|
||||
Second crlfs
|
||||
|
||||
Third crs
|
||||
|
||||
Fourth line</string></value>
|
||||
</param>
|
||||
</params>
|
||||
</methodCall>
|
||||
";
|
||||
|
||||
|
||||
$msg = new XML_RPC_Message('nada', array(XML_RPC_encode($input)));
|
||||
$msg->createPayload();
|
||||
if ($msg->payload == $expect_removed) {
|
||||
echo "passed\n";
|
||||
} else {
|
||||
echo "PROBLEM\n";
|
||||
}
|
||||
|
||||
$msg = new XML_RPC_Message('nada', array(XML_RPC_encode($input)));
|
||||
$msg->remove_extra_lines = false;
|
||||
$msg->createPayload();
|
||||
if ($msg->payload == $expect_not_removed) {
|
||||
echo "passed\n";
|
||||
} else {
|
||||
echo "PROBLEM\n";
|
||||
}
|
||||
437
include/pear/tests/XML_RPC/tests/protoport.php
Normal file
437
include/pear/tests/XML_RPC/tests/protoport.php
Normal file
@@ -0,0 +1,437 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Tests that properties of XML_RPC_Client get properly set
|
||||
*
|
||||
* Any individual tests that fail will have their name, expected result
|
||||
* and actual result printed out. So seeing no output when executing
|
||||
* this file is a good thing.
|
||||
*
|
||||
* Can be run via CLI or a web server.
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* LICENSE: This source file is subject to version 3.01 of the PHP license
|
||||
* that is available through the world-wide-web at the following URI:
|
||||
* http://www.php.net/license/3_01.txt. If you did not receive a copy of
|
||||
* the PHP License and are unable to obtain it through the web, please
|
||||
* send a note to license@php.net so we can mail you a copy immediately.
|
||||
*
|
||||
* @category Web Services
|
||||
* @package XML_RPC
|
||||
* @author Daniel Convissor <danielc@php.net>
|
||||
* @copyright 2005-2006 The PHP Group
|
||||
* @license http://www.php.net/license/3_01.txt PHP License
|
||||
* @version CVS: $Id: protoport.php,v 1.6 2006/06/11 00:25:17 danielc Exp $
|
||||
* @link http://pear.php.net/package/XML_RPC
|
||||
* @since File available since Release 1.2
|
||||
*/
|
||||
|
||||
/*
|
||||
* If the package version number is found in the left hand
|
||||
* portion of the if() expression below, that means this file has
|
||||
* come from the PEAR installer. Therefore, let's test the
|
||||
* installed version of XML_RPC which should be in the include path.
|
||||
*
|
||||
* If the version has not been substituted in the if() expression,
|
||||
* this file has likely come from a CVS checkout or a .tar file.
|
||||
* Therefore, we'll assume the tests should use the version of
|
||||
* XML_RPC that has come from there as well.
|
||||
*/
|
||||
if ('1.5.1' != '@'.'package_version'.'@') {
|
||||
/**
|
||||
* Get the needed class from the PEAR installation
|
||||
*/
|
||||
require_once 'XML/RPC.php';
|
||||
} else {
|
||||
/**
|
||||
* Get the needed class from the parent directory
|
||||
*/
|
||||
require_once '../RPC.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare the test result to the expected result
|
||||
*
|
||||
* If the test fails, echo out the results.
|
||||
*
|
||||
* @param array $expect the array of object properties you expect
|
||||
* from the test
|
||||
* @param object $actual the object results from the test
|
||||
* @param string $test_name the name of the test
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function compare($expect, $actual, $test_name) {
|
||||
$actual = get_object_vars($actual);
|
||||
if (count(array_diff($actual, $expect))) {
|
||||
echo "$test_name failed.\nExpect: ";
|
||||
print_r($expect);
|
||||
echo "Actual: ";
|
||||
print_r($actual);
|
||||
echo "\n";
|
||||
}
|
||||
}
|
||||
|
||||
if (php_sapi_name() != 'cli') {
|
||||
echo "<pre>\n";
|
||||
}
|
||||
|
||||
|
||||
$x = array(
|
||||
'path' => 'thepath',
|
||||
'server' => 'theserver',
|
||||
'protocol' => 'http://',
|
||||
'port' => 80,
|
||||
'proxy' => '',
|
||||
'proxy_protocol' => 'http://',
|
||||
'proxy_port' => 8080,
|
||||
'proxy_user' => '',
|
||||
'proxy_pass' => '',
|
||||
'errno' => 0,
|
||||
'errstring' => '',
|
||||
'debug' => 0,
|
||||
'username' => '',
|
||||
'password' => '',
|
||||
);
|
||||
$c = new XML_RPC_Client('thepath', 'theserver');
|
||||
compare($x, $c, 'defaults');
|
||||
|
||||
$x = array(
|
||||
'path' => 'thepath',
|
||||
'server' => 'theserver',
|
||||
'protocol' => 'http://',
|
||||
'port' => 80,
|
||||
'proxy' => '',
|
||||
'proxy_protocol' => 'http://',
|
||||
'proxy_port' => 8080,
|
||||
'proxy_user' => '',
|
||||
'proxy_pass' => '',
|
||||
'errno' => 0,
|
||||
'errstring' => '',
|
||||
'debug' => 0,
|
||||
'username' => '',
|
||||
'password' => '',
|
||||
);
|
||||
$c = new XML_RPC_Client('thepath', 'http://theserver');
|
||||
compare($x, $c, 'defaults with http');
|
||||
|
||||
$x = array(
|
||||
'path' => 'thepath',
|
||||
'server' => 'theserver',
|
||||
'protocol' => 'ssl://',
|
||||
'port' => 443,
|
||||
'proxy' => '',
|
||||
'proxy_protocol' => 'http://',
|
||||
'proxy_port' => 8080,
|
||||
'proxy_user' => '',
|
||||
'proxy_pass' => '',
|
||||
'errno' => 0,
|
||||
'errstring' => '',
|
||||
'debug' => 0,
|
||||
'username' => '',
|
||||
'password' => '',
|
||||
);
|
||||
$c = new XML_RPC_Client('thepath', 'https://theserver');
|
||||
compare($x, $c, 'defaults with https');
|
||||
|
||||
$x = array(
|
||||
'path' => 'thepath',
|
||||
'server' => 'theserver',
|
||||
'protocol' => 'ssl://',
|
||||
'port' => 443,
|
||||
'proxy' => '',
|
||||
'proxy_protocol' => 'http://',
|
||||
'proxy_port' => 8080,
|
||||
'proxy_user' => '',
|
||||
'proxy_pass' => '',
|
||||
'errno' => 0,
|
||||
'errstring' => '',
|
||||
'debug' => 0,
|
||||
'username' => '',
|
||||
'password' => '',
|
||||
);
|
||||
$c = new XML_RPC_Client('thepath', 'ssl://theserver');
|
||||
compare($x, $c, 'defaults with ssl');
|
||||
|
||||
|
||||
$x = array(
|
||||
'path' => 'thepath',
|
||||
'server' => 'theserver',
|
||||
'protocol' => 'http://',
|
||||
'port' => 65,
|
||||
'proxy' => '',
|
||||
'proxy_protocol' => 'http://',
|
||||
'proxy_port' => 8080,
|
||||
'proxy_user' => '',
|
||||
'proxy_pass' => '',
|
||||
'errno' => 0,
|
||||
'errstring' => '',
|
||||
'debug' => 0,
|
||||
'username' => '',
|
||||
'password' => '',
|
||||
);
|
||||
$c = new XML_RPC_Client('thepath', 'theserver', 65);
|
||||
compare($x, $c, 'port 65');
|
||||
|
||||
$x = array(
|
||||
'path' => 'thepath',
|
||||
'server' => 'theserver',
|
||||
'protocol' => 'http://',
|
||||
'port' => 65,
|
||||
'proxy' => '',
|
||||
'proxy_protocol' => 'http://',
|
||||
'proxy_port' => 8080,
|
||||
'proxy_user' => '',
|
||||
'proxy_pass' => '',
|
||||
'errno' => 0,
|
||||
'errstring' => '',
|
||||
'debug' => 0,
|
||||
'username' => '',
|
||||
'password' => '',
|
||||
);
|
||||
$c = new XML_RPC_Client('thepath', 'http://theserver', 65);
|
||||
compare($x, $c, 'port 65 with http');
|
||||
|
||||
$x = array(
|
||||
'path' => 'thepath',
|
||||
'server' => 'theserver',
|
||||
'protocol' => 'ssl://',
|
||||
'port' => 65,
|
||||
'proxy' => '',
|
||||
'proxy_protocol' => 'http://',
|
||||
'proxy_port' => 8080,
|
||||
'proxy_user' => '',
|
||||
'proxy_pass' => '',
|
||||
'errno' => 0,
|
||||
'errstring' => '',
|
||||
'debug' => 0,
|
||||
'username' => '',
|
||||
'password' => '',
|
||||
);
|
||||
$c = new XML_RPC_Client('thepath', 'https://theserver', 65);
|
||||
compare($x, $c, 'port 65 with https');
|
||||
|
||||
$x = array(
|
||||
'path' => 'thepath',
|
||||
'server' => 'theserver',
|
||||
'protocol' => 'ssl://',
|
||||
'port' => 65,
|
||||
'proxy' => '',
|
||||
'proxy_protocol' => 'http://',
|
||||
'proxy_port' => 8080,
|
||||
'proxy_user' => '',
|
||||
'proxy_pass' => '',
|
||||
'errno' => 0,
|
||||
'errstring' => '',
|
||||
'debug' => 0,
|
||||
'username' => '',
|
||||
'password' => '',
|
||||
);
|
||||
$c = new XML_RPC_Client('thepath', 'ssl://theserver', 65);
|
||||
compare($x, $c, 'port 65 with ssl');
|
||||
|
||||
|
||||
$x = array(
|
||||
'path' => 'thepath',
|
||||
'server' => 'theserver',
|
||||
'protocol' => 'http://',
|
||||
'port' => 80,
|
||||
'proxy' => 'theproxy',
|
||||
'proxy_protocol' => 'http://',
|
||||
'proxy_port' => 8080,
|
||||
'proxy_user' => '',
|
||||
'proxy_pass' => '',
|
||||
'errno' => 0,
|
||||
'errstring' => '',
|
||||
'debug' => 0,
|
||||
'username' => '',
|
||||
'password' => '',
|
||||
);
|
||||
$c = new XML_RPC_Client('thepath', 'theserver', 0,
|
||||
'theproxy');
|
||||
compare($x, $c, 'defaults proxy');
|
||||
|
||||
$x = array(
|
||||
'path' => 'thepath',
|
||||
'server' => 'theserver',
|
||||
'protocol' => 'http://',
|
||||
'port' => 80,
|
||||
'proxy' => 'theproxy',
|
||||
'proxy_protocol' => 'http://',
|
||||
'proxy_port' => 8080,
|
||||
'proxy_user' => '',
|
||||
'proxy_pass' => '',
|
||||
'errno' => 0,
|
||||
'errstring' => '',
|
||||
'debug' => 0,
|
||||
'username' => '',
|
||||
'password' => '',
|
||||
);
|
||||
$c = new XML_RPC_Client('thepath', 'http://theserver', 0,
|
||||
'http://theproxy');
|
||||
compare($x, $c, 'defaults with http proxy');
|
||||
|
||||
$x = array(
|
||||
'path' => 'thepath',
|
||||
'server' => 'theserver',
|
||||
'protocol' => 'ssl://',
|
||||
'port' => 443,
|
||||
'proxy' => 'theproxy',
|
||||
'proxy_protocol' => 'ssl://',
|
||||
'proxy_port' => 443,
|
||||
'proxy_user' => '',
|
||||
'proxy_pass' => '',
|
||||
'errno' => 0,
|
||||
'errstring' => '',
|
||||
'debug' => 0,
|
||||
'username' => '',
|
||||
'password' => '',
|
||||
);
|
||||
$c = new XML_RPC_Client('thepath', 'https://theserver', 0,
|
||||
'https://theproxy');
|
||||
compare($x, $c, 'defaults with https proxy');
|
||||
|
||||
$x = array(
|
||||
'path' => 'thepath',
|
||||
'server' => 'theserver',
|
||||
'protocol' => 'ssl://',
|
||||
'port' => 443,
|
||||
'proxy' => 'theproxy',
|
||||
'proxy_protocol' => 'ssl://',
|
||||
'proxy_port' => 443,
|
||||
'proxy_user' => '',
|
||||
'proxy_pass' => '',
|
||||
'errno' => 0,
|
||||
'errstring' => '',
|
||||
'debug' => 0,
|
||||
'username' => '',
|
||||
'password' => '',
|
||||
);
|
||||
$c = new XML_RPC_Client('thepath', 'ssl://theserver', 0,
|
||||
'ssl://theproxy');
|
||||
compare($x, $c, 'defaults with ssl proxy');
|
||||
|
||||
|
||||
$x = array(
|
||||
'path' => 'thepath',
|
||||
'server' => 'theserver',
|
||||
'protocol' => 'http://',
|
||||
'port' => 65,
|
||||
'proxy' => 'theproxy',
|
||||
'proxy_protocol' => 'http://',
|
||||
'proxy_port' => 6565,
|
||||
'proxy_user' => '',
|
||||
'proxy_pass' => '',
|
||||
'errno' => 0,
|
||||
'errstring' => '',
|
||||
'debug' => 0,
|
||||
'username' => '',
|
||||
'password' => '',
|
||||
);
|
||||
$c = new XML_RPC_Client('thepath', 'theserver', 65,
|
||||
'theproxy', 6565);
|
||||
compare($x, $c, 'port 65 proxy 6565');
|
||||
|
||||
$x = array(
|
||||
'path' => 'thepath',
|
||||
'server' => 'theserver',
|
||||
'protocol' => 'http://',
|
||||
'port' => 65,
|
||||
'proxy' => 'theproxy',
|
||||
'proxy_protocol' => 'http://',
|
||||
'proxy_port' => 6565,
|
||||
'proxy_user' => '',
|
||||
'proxy_pass' => '',
|
||||
'errno' => 0,
|
||||
'errstring' => '',
|
||||
'debug' => 0,
|
||||
'username' => '',
|
||||
'password' => '',
|
||||
);
|
||||
$c = new XML_RPC_Client('thepath', 'http://theserver', 65,
|
||||
'http://theproxy', 6565);
|
||||
compare($x, $c, 'port 65 with http proxy 6565');
|
||||
|
||||
$x = array(
|
||||
'path' => 'thepath',
|
||||
'server' => 'theserver',
|
||||
'protocol' => 'ssl://',
|
||||
'port' => 65,
|
||||
'proxy' => 'theproxy',
|
||||
'proxy_protocol' => 'ssl://',
|
||||
'proxy_port' => 6565,
|
||||
'proxy_user' => '',
|
||||
'proxy_pass' => '',
|
||||
'errno' => 0,
|
||||
'errstring' => '',
|
||||
'debug' => 0,
|
||||
'username' => '',
|
||||
'password' => '',
|
||||
);
|
||||
$c = new XML_RPC_Client('thepath', 'https://theserver', 65,
|
||||
'https://theproxy', 6565);
|
||||
compare($x, $c, 'port 65 with https proxy 6565');
|
||||
|
||||
$x = array(
|
||||
'path' => 'thepath',
|
||||
'server' => 'theserver',
|
||||
'protocol' => 'ssl://',
|
||||
'port' => 65,
|
||||
'proxy' => 'theproxy',
|
||||
'proxy_protocol' => 'ssl://',
|
||||
'proxy_port' => 6565,
|
||||
'proxy_user' => '',
|
||||
'proxy_pass' => '',
|
||||
'errno' => 0,
|
||||
'errstring' => '',
|
||||
'debug' => 0,
|
||||
'username' => '',
|
||||
'password' => '',
|
||||
);
|
||||
$c = new XML_RPC_Client('thepath', 'ssl://theserver', 65,
|
||||
'ssl://theproxy', 6565);
|
||||
compare($x, $c, 'port 65 with ssl proxy 6565');
|
||||
|
||||
|
||||
$x = array(
|
||||
'path' => 'thepath',
|
||||
'server' => 'theserver',
|
||||
'protocol' => 'ssl://',
|
||||
'port' => 443,
|
||||
'proxy' => 'theproxy',
|
||||
'proxy_protocol' => 'ssl://',
|
||||
'proxy_port' => 443,
|
||||
'proxy_user' => '',
|
||||
'proxy_pass' => '',
|
||||
'errno' => 0,
|
||||
'errstring' => '',
|
||||
'debug' => 0,
|
||||
'username' => '',
|
||||
'password' => '',
|
||||
);
|
||||
$c = new XML_RPC_Client('thepath', 'theserver', 443,
|
||||
'theproxy', 443);
|
||||
compare($x, $c, 'port 443 no protocol and proxy port 443 no protocol');
|
||||
|
||||
$x = array(
|
||||
'path' => 'thepath',
|
||||
'server' => 'theserver',
|
||||
'protocol' => 'http://',
|
||||
'port' => 80,
|
||||
'proxy' => 'theproxy',
|
||||
'proxy_protocol' => 'ssl://',
|
||||
'proxy_port' => 6565,
|
||||
'proxy_user' => '',
|
||||
'proxy_pass' => '',
|
||||
'errno' => 0,
|
||||
'errstring' => '',
|
||||
'debug' => 0,
|
||||
'username' => '',
|
||||
'password' => '',
|
||||
);
|
||||
$c = new XML_RPC_Client('thepath', 'theserver', 0,
|
||||
'ssl://theproxy', 6565);
|
||||
compare($x, $c, 'port 443 no protocol and proxy port 443 no protocol');
|
||||
|
||||
echo "\nIf no other output was produced, these tests passed.\n";
|
||||
50
include/pear/tests/XML_RPC/tests/test_Dump.php
Normal file
50
include/pear/tests/XML_RPC/tests/test_Dump.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* If the package version number is found in the left hand
|
||||
* portion of the if() expression below, that means this file has
|
||||
* come from the PEAR installer. Therefore, let's test the
|
||||
* installed version of XML_RPC which should be in the include path.
|
||||
*
|
||||
* If the version has not been substituted in the if() expression,
|
||||
* this file has likely come from a CVS checkout or a .tar file.
|
||||
* Therefore, we'll assume the tests should use the version of
|
||||
* XML_RPC that has come from there as well.
|
||||
*/
|
||||
if ('1.5.1' != '@'.'package_version'.'@') {
|
||||
/**
|
||||
* Get the needed class from the PEAR installation
|
||||
*/
|
||||
require_once 'XML/RPC/Dump.php';
|
||||
} else {
|
||||
/**
|
||||
* Get the needed class from the parent directory
|
||||
*/
|
||||
require_once '../Dump.php';
|
||||
}
|
||||
|
||||
$val = new XML_RPC_Value(array(
|
||||
'title' =>new XML_RPC_Value('das ist der Titel', 'string'),
|
||||
'startDate'=>new XML_RPC_Value(mktime(0,0,0,13,11,2004), 'dateTime.iso8601'),
|
||||
'endDate' =>new XML_RPC_Value(mktime(0,0,0,15,11,2004), 'dateTime.iso8601'),
|
||||
'error' =>'string',
|
||||
'arkey' => new XML_RPC_Value( array(
|
||||
new XML_RPC_Value('simple string'),
|
||||
new XML_RPC_Value(12345, 'int')
|
||||
), 'array')
|
||||
)
|
||||
,'struct');
|
||||
|
||||
XML_RPC_Dump($val);
|
||||
|
||||
echo '==============' . "\r\n";
|
||||
$val2 = new XML_RPC_Value(44353, 'int');
|
||||
XML_RPC_Dump($val2);
|
||||
|
||||
echo '==============' . "\r\n";
|
||||
$val3 = new XML_RPC_Value('this should be a string', 'string');
|
||||
XML_RPC_Dump($val3);
|
||||
|
||||
echo '==============' . "\r\n";
|
||||
$val4 = new XML_RPC_Value(true, 'boolean');
|
||||
XML_RPC_Dump($val4);
|
||||
132
include/pear/tests/XML_RPC/tests/types.php
Normal file
132
include/pear/tests/XML_RPC/tests/types.php
Normal file
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Tests how the XML_RPC server handles a bunch of different parameter
|
||||
* data types.
|
||||
*
|
||||
* If you are running this test from a CVS checkout, you must rename the working
|
||||
* directory from "XML_RPC" to "XML".
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* LICENSE: This source file is subject to version 3.01 of the PHP license
|
||||
* that is available through the world-wide-web at the following URI:
|
||||
* http://www.php.net/license/3_01.txt. If you did not receive a copy of
|
||||
* the PHP License and are unable to obtain it through the web, please
|
||||
* send a note to license@php.net so we can mail you a copy immediately.
|
||||
*
|
||||
* @category Web Services
|
||||
* @package XML_RPC
|
||||
* @author Daniel Convissor <danielc@php.net>
|
||||
* @copyright 2005-2006 The PHP Group
|
||||
* @license http://www.php.net/license/3_01.txt PHP License
|
||||
* @version CVS: $Id: types.php,v 1.2 2006/06/11 00:25:17 danielc Exp $
|
||||
* @link http://pear.php.net/package/XML_RPC
|
||||
* @since File available since Release 1.4.4
|
||||
*/
|
||||
|
||||
/*
|
||||
* If the package version number is found in the left hand
|
||||
* portion of the if() expression below, that means this file has
|
||||
* come from the PEAR installer. Therefore, let's test the
|
||||
* installed version of XML_RPC which should be in the include path.
|
||||
*
|
||||
* If the version has not been substituted in the if() expression,
|
||||
* this file has likely come from a CVS checkout or a .tar file.
|
||||
* Therefore, we'll assume the tests should use the version of
|
||||
* XML_RPC that has come from there as well.
|
||||
*/
|
||||
if ('1.5.1' != '@'.'package_version'.'@') {
|
||||
/**
|
||||
* Get the needed class from the PEAR installation
|
||||
*/
|
||||
require_once 'XML/RPC/Server.php';
|
||||
} else {
|
||||
if (substr(dirname(__FILE__), -9, -6) != 'XML') {
|
||||
echo "The parent directory must be named 'XML'.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
ini_set('include_path', '../../'
|
||||
. PATH_SEPARATOR . '.' . PATH_SEPARATOR
|
||||
. ini_get('include_path')
|
||||
);
|
||||
|
||||
/**
|
||||
* Get the needed class from the parent directory
|
||||
*/
|
||||
require_once '../Server.php';
|
||||
}
|
||||
|
||||
$GLOBALS['HTTP_RAW_POST_DATA'] = <<<EOPOST
|
||||
<?xml version="1.0"?>
|
||||
<methodCall>
|
||||
<methodName>allgot</methodName>
|
||||
<params>
|
||||
<param><value>default to string</value></param>
|
||||
<param><value><string>inside string</string></value></param>
|
||||
<param><value><int>8</int></value></param>
|
||||
<param><value><datetime.iso8601>20050809T01:33:44</datetime.iso8601></value></param>
|
||||
|
||||
<param>
|
||||
<value>
|
||||
<array>
|
||||
<data>
|
||||
<value>
|
||||
<string>a</string>
|
||||
</value>
|
||||
<value>
|
||||
<string>b</string>
|
||||
</value>
|
||||
</data>
|
||||
</array>
|
||||
</value>
|
||||
</param>
|
||||
|
||||
<param>
|
||||
<value>
|
||||
<struct>
|
||||
<member>
|
||||
<name>a</name>
|
||||
<value>
|
||||
<string>ay</string>
|
||||
</value>
|
||||
</member>
|
||||
<member>
|
||||
<name>b</name>
|
||||
<value>
|
||||
<string>be</string>
|
||||
</value>
|
||||
</member>
|
||||
</struct>
|
||||
</value>
|
||||
</param>
|
||||
|
||||
</params>
|
||||
</methodCall>
|
||||
EOPOST;
|
||||
|
||||
$expect = <<<EOEXP
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<methodResponse>
|
||||
<params>
|
||||
<param>
|
||||
<value><string>param 0: 'default to string'
|
||||
param 1: 'inside string'
|
||||
param 2: '8'
|
||||
param 3: '20050809T01:33:44'
|
||||
param 4: array (
|
||||
0 => 'a',
|
||||
1 => 'b',
|
||||
)
|
||||
param 5: array (
|
||||
'a' => 'ay',
|
||||
'b' => 'be',
|
||||
)
|
||||
</string></value>
|
||||
</param>
|
||||
</params>
|
||||
</methodResponse>
|
||||
EOEXP;
|
||||
|
||||
include './allgot.inc';
|
||||
Reference in New Issue
Block a user