PageRenderTime 49ms CodeModel.GetById 29ms RepoModel.GetById 0ms app.codeStats 0ms

/sys/external/PEAR/XML_RPC-1.5.1/tests/empty-value-struct.php

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