mirror of
https://github.com/php/php-src.git
synced 2024-11-28 12:26:37 +08:00
Create test to the extension xmlrpc
This commit is contained in:
parent
e960eebfea
commit
acda3dab6c
109
ext/xmlrpc/tests/003.phpt
Normal file
109
ext/xmlrpc/tests/003.phpt
Normal file
@ -0,0 +1,109 @@
|
||||
--TEST--
|
||||
xmlrpc_encode() Simple test encode array
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("xmlrpc")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$params = array(
|
||||
"one" => "red",
|
||||
"two" => "blue",
|
||||
"three" => "green"
|
||||
);
|
||||
|
||||
$response = xmlrpc_encode($params);
|
||||
echo $response;
|
||||
|
||||
$params = array(
|
||||
"red",
|
||||
"blue",
|
||||
"green"
|
||||
);
|
||||
|
||||
$response = xmlrpc_encode($params);
|
||||
echo $response;
|
||||
|
||||
$params = array(
|
||||
0 => "red",
|
||||
1 => "blue",
|
||||
3 => "green"
|
||||
);
|
||||
|
||||
$response = xmlrpc_encode($params);
|
||||
echo $response;
|
||||
|
||||
--EXPECT--
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<params>
|
||||
<param>
|
||||
<value>
|
||||
<struct>
|
||||
<member>
|
||||
<name>one</name>
|
||||
<value>
|
||||
<string>red</string>
|
||||
</value>
|
||||
</member>
|
||||
<member>
|
||||
<name>two</name>
|
||||
<value>
|
||||
<string>blue</string>
|
||||
</value>
|
||||
</member>
|
||||
<member>
|
||||
<name>three</name>
|
||||
<value>
|
||||
<string>green</string>
|
||||
</value>
|
||||
</member>
|
||||
</struct>
|
||||
</value>
|
||||
</param>
|
||||
</params>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<params>
|
||||
<param>
|
||||
<value>
|
||||
<array>
|
||||
<data>
|
||||
<value>
|
||||
<string>red</string>
|
||||
</value>
|
||||
<value>
|
||||
<string>blue</string>
|
||||
</value>
|
||||
<value>
|
||||
<string>green</string>
|
||||
</value>
|
||||
</data>
|
||||
</array>
|
||||
</value>
|
||||
</param>
|
||||
</params>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<params>
|
||||
<param>
|
||||
<value>
|
||||
<struct>
|
||||
<member>
|
||||
<name>0</name>
|
||||
<value>
|
||||
<string>red</string>
|
||||
</value>
|
||||
</member>
|
||||
<member>
|
||||
<name>1</name>
|
||||
<value>
|
||||
<string>blue</string>
|
||||
</value>
|
||||
</member>
|
||||
<member>
|
||||
<name>3</name>
|
||||
<value>
|
||||
<string>green</string>
|
||||
</value>
|
||||
</member>
|
||||
</struct>
|
||||
</value>
|
||||
</param>
|
||||
</params>
|
19
ext/xmlrpc/tests/004.phpt
Normal file
19
ext/xmlrpc/tests/004.phpt
Normal file
@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
xmlrpc_encode() Simple test encode int
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("xmlrpc")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$response = xmlrpc_encode(1);
|
||||
echo $response;
|
||||
|
||||
--EXPECT--
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<params>
|
||||
<param>
|
||||
<value>
|
||||
<int>1</int>
|
||||
</value>
|
||||
</param>
|
||||
</params>
|
Loading…
Reference in New Issue
Block a user