PageRenderTime 39ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/lib/pear/tests/XML_RPC/tests/empty-value.php

https://github.com/yrchen/OPMS
PHP | 88 lines | 41 code | 7 blank | 40 comment | 5 complexity | 16e9b85261cfa3ce920994dcf85bb028 MD5 | raw file
Possible License(s): BSD-3-Clause, LGPL-2.0
  1. <?php
  2. /**
  3. * Tests how the XML_RPC server handles parameters with empty values.
  4. *
  5. * If you are running this test from a CVS checkout, you must rename the working
  6. * directory from "XML_RPC" to "XML".
  7. *
  8. * PHP versions 4 and 5
  9. *
  10. * LICENSE: This source file is subject to version 3.01 of the PHP license
  11. * that is available through the world-wide-web at the following URI:
  12. * http://www.php.net/license/3_01.txt. If you did not receive a copy of
  13. * the PHP License and are unable to obtain it through the web, please
  14. * send a note to license@php.net so we can mail you a copy immediately.
  15. *
  16. * @category Web Services
  17. * @package XML_RPC
  18. * @author Daniel Convissor <danielc@php.net>
  19. * @copyright 2005-2006 The PHP Group
  20. * @license http://www.php.net/license/3_01.txt PHP License
  21. * @version CVS: $Id: empty-value.php,v 1.2 2006/06/11 00:25:17 danielc Exp $
  22. * @link http://pear.php.net/package/XML_RPC
  23. * @since File available since Release 1.4.4
  24. */
  25. /*
  26. * If the package version number is found in the left hand
  27. * portion of the if() expression below, that means this file has
  28. * come from the PEAR installer. Therefore, let's test the
  29. * installed version of XML_RPC which should be in the include path.
  30. *
  31. * If the version has not been substituted in the if() expression,
  32. * this file has likely come from a CVS checkout or a .tar file.
  33. * Therefore, we'll assume the tests should use the version of
  34. * XML_RPC that has come from there as well.
  35. */
  36. if ('1.5.0' != '@'.'package_version'.'@') {
  37. /**
  38. * Get the needed class from the PEAR installation
  39. */
  40. require_once 'XML/RPC/Server.php';
  41. } else {
  42. if (substr(dirname(__FILE__), -9, -6) != 'XML') {
  43. echo "The parent directory must be named 'XML'.\n";
  44. exit;
  45. }
  46. ini_set('include_path', '../../'
  47. . PATH_SEPARATOR . '.' . PATH_SEPARATOR
  48. . ini_get('include_path')
  49. );
  50. /**
  51. * Get the needed class from the parent directory
  52. */
  53. require_once '../Server.php';
  54. }
  55. $GLOBALS['HTTP_RAW_POST_DATA'] = <<<EOPOST
  56. <?xml version="1.0"?>
  57. <methodCall>
  58. <methodName>allgot</methodName>
  59. <params>
  60. <param><value><string></string></value></param>
  61. <param><value>first</value></param>
  62. <param><value> </value></param>
  63. <param><value></value></param>
  64. </params>
  65. </methodCall>
  66. EOPOST;
  67. $expect = <<<EOEXP
  68. <?xml version="1.0" encoding="UTF-8"?>
  69. <methodResponse>
  70. <params>
  71. <param>
  72. <value><string>param 0: ''
  73. param 1: 'first'
  74. param 2: ' '
  75. param 3: ''
  76. </string></value>
  77. </param>
  78. </params>
  79. </methodResponse>
  80. EOEXP;
  81. include './allgot.inc';