summaryrefslogtreecommitdiff
path: root/modules/simpletest/tests/xmlrpc_test.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-08-09 12:41:23 +0000
committerDries Buytaert <dries@buytaert.net>2008-08-09 12:41:23 +0000
commit0d1995a828dd530092d23ef8a1c5062e080facec (patch)
tree01a6b9abdf2d174e8729ca672dc1a1ba3778ee64 /modules/simpletest/tests/xmlrpc_test.module
parentab5cdfda6134cca2b1981b8507aa23c43c165b3b (diff)
downloadbrdo-0d1995a828dd530092d23ef8a1c5062e080facec.tar.gz
brdo-0d1995a828dd530092d23ef8a1c5062e080facec.tar.bz2
- Patch #268063 by boombatower, chx, cwgordon7, Damien Tournoud: move includes/tests to simpletest/tests and provide hidden .info propery
Diffstat (limited to 'modules/simpletest/tests/xmlrpc_test.module')
-rw-r--r--modules/simpletest/tests/xmlrpc_test.module62
1 files changed, 62 insertions, 0 deletions
diff --git a/modules/simpletest/tests/xmlrpc_test.module b/modules/simpletest/tests/xmlrpc_test.module
new file mode 100644
index 000000000..3534a7266
--- /dev/null
+++ b/modules/simpletest/tests/xmlrpc_test.module
@@ -0,0 +1,62 @@
+<?php
+// $Id$
+
+function xmlrpc_test_arrayOfStructsTest($array) {
+ $sum = 0;
+ foreach ($array as $struct) {
+ if (isset($struct['curly'])) {
+ $sum += $struct['curly'];
+ }
+ }
+ return $sum;
+}
+
+function xmlrpc_test_countTheEntities($string) {
+ return array(
+ 'ctLeftAngleBrackets' => substr_count($string, '<'),
+ 'ctRightAngleBrackets' => substr_count($string, '>'),
+ 'ctAmpersands' => substr_count($string, '&'),
+ 'ctApostrophes' => substr_count($string, "'"),
+ 'ctQuotes' => substr_count($string, '"'),
+ );
+}
+
+function xmlrpc_test_easyStructTest($array) {
+ return $array["curly"] + $array["moe"] + $array["larry"];
+}
+
+function xmlrpc_test_echoStructTest($array) {
+ return $array;
+}
+
+function xmlrpc_test_manyTypesTest($number, $boolean, $string, $double, $dateTime, $base64) {
+ $timestamp = mktime($dateTime->hour, $dateTime->minute, $dateTime->second, $dateTime->month, $dateTime->day, $dateTime->year);
+ return array($number, $boolean, $string, $double, xmlrpc_date($timestamp), xmlrpc_Base64($base64));
+}
+
+function xmlrpc_test_moderateSizeArrayCheck($array) {
+ return array_shift($array) . array_pop($array);
+}
+
+function xmlrpc_test_nestedStructTest($array) {
+ return $array["2000"]["04"]["01"]["larry"] + $array["2000"]["04"]["01"]["moe"] + $array["2000"]["04"]["01"]["curly"];
+}
+
+function xmlrpc_test_simpleStructReturnTest($number) {
+ return array("times10" => ($number*10), "times100" => ($number*100), "times1000" => ($number*1000));
+}
+
+/**
+ * Implementation of hook_xmlrpc()
+ */
+function xmlrpc_test_xmlrpc() {
+ return array(
+ 'validator1.arrayOfStructsTest' => 'xmlrpc_test_arrayOfStructsTest',
+ 'validator1.countTheEntities' => 'xmlrpc_test_countTheEntities',
+ 'validator1.easyStructTest' => 'xmlrpc_test_easyStructTest',
+ 'validator1.echoStructTest' => 'xmlrpc_test_echoStructTest',
+ 'validator1.manyTypesTest' => 'xmlrpc_test_manyTypesTest',
+ 'validator1.moderateSizeArrayCheck' => 'xmlrpc_test_moderateSizeArrayCheck',
+ 'validator1.nestedStructTest' => 'xmlrpc_test_nestedStructTest',
+ 'validator1.simpleStructReturnTest' => 'xmlrpc_test_simpleStructReturnTest');
+}