| 1 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/**
|
|
|
4 |
* Actually performs an XML_RPC request.
|
|
|
5 |
*
|
|
|
6 |
* PHP versions 4 and 5
|
|
|
7 |
*
|
|
|
8 |
* @category Web Services
|
|
|
9 |
* @package XML_RPC
|
|
|
10 |
* @author Daniel Convissor <danielc@php.net>
|
|
|
11 |
* @copyright 2005-2010 The PHP Group
|
|
|
12 |
* @license http://www.php.net/license/3_01.txt PHP License
|
|
|
13 |
* @version SVN: $Id: test_Dump.php 300962 2010-07-03 02:24:24Z danielc $
|
|
|
14 |
* @link http://pear.php.net/package/XML_RPC
|
|
|
15 |
*/
|
|
|
16 |
|
|
|
17 |
/*
|
|
|
18 |
* If the package version number is found in the left hand
|
|
|
19 |
* portion of the if() expression below, that means this file has
|
|
|
20 |
* come from the PEAR installer. Therefore, let's test the
|
|
|
21 |
* installed version of XML_RPC which should be in the include path.
|
|
|
22 |
*
|
|
|
23 |
* If the version has not been substituted in the if() expression,
|
|
|
24 |
* this file has likely come from a SVN checkout or a .tar file.
|
|
|
25 |
* Therefore, we'll assume the tests should use the version of
|
|
|
26 |
* XML_RPC that has come from there as well.
|
|
|
27 |
*/
|
|
|
28 |
if ('1.5.5' == '@'.'package_version'.'@') {
|
|
|
29 |
ini_set('include_path', '../'
|
|
|
30 |
. PATH_SEPARATOR . '.' . PATH_SEPARATOR
|
|
|
31 |
. ini_get('include_path')
|
|
|
32 |
);
|
|
|
33 |
}
|
|
|
34 |
require_once 'XML/RPC/Dump.php';
|
|
|
35 |
|
|
|
36 |
|
|
|
37 |
$val = new XML_RPC_Value(array(
|
|
|
38 |
'title' =>new XML_RPC_Value('das ist der Titel', 'string'),
|
|
|
39 |
'startDate'=>new XML_RPC_Value(mktime(0,0,0,13,11,2004), 'dateTime.iso8601'),
|
|
|
40 |
'endDate' =>new XML_RPC_Value(mktime(0,0,0,15,11,2004), 'dateTime.iso8601'),
|
|
|
41 |
'arkey' => new XML_RPC_Value( array(
|
|
|
42 |
new XML_RPC_Value('simple string'),
|
|
|
43 |
new XML_RPC_Value(12345, 'int')
|
|
|
44 |
), 'array')
|
|
|
45 |
)
|
|
|
46 |
,'struct');
|
|
|
47 |
|
|
|
48 |
XML_RPC_Dump($val);
|
|
|
49 |
|
|
|
50 |
echo '==============' . "\r\n";
|
|
|
51 |
$val2 = new XML_RPC_Value(44353, 'int');
|
|
|
52 |
XML_RPC_Dump($val2);
|
|
|
53 |
|
|
|
54 |
echo '==============' . "\r\n";
|
|
|
55 |
$val3 = new XML_RPC_Value('this should be a string', 'string');
|
|
|
56 |
XML_RPC_Dump($val3);
|
|
|
57 |
|
|
|
58 |
echo '==============' . "\r\n";
|
|
|
59 |
$val4 = new XML_RPC_Value(true, 'boolean');
|
|
|
60 |
XML_RPC_Dump($val4);
|
|
|
61 |
|
|
|
62 |
echo '==============' . "\r\n";
|
|
|
63 |
echo 'Next we will test the error handling...' . "\r\n";
|
|
|
64 |
$val5 = new XML_RPC_Value(array(
|
|
|
65 |
'foo' => 'bar'
|
|
|
66 |
), 'struct');
|
|
|
67 |
XML_RPC_Dump($val5);
|
|
|
68 |
|
|
|
69 |
echo '==============' . "\r\n";
|
|
|
70 |
echo 'DONE' . "\r\n";
|