[ Index ]
 

Code source de PHP PEAR 1.4.5

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/tests/XML_RPC/tests/ -> empty-value.php (source)

   1  <?php
   2  
   3  /**
   4   * Tests how the XML_RPC server handles parameters with empty values.
   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.01 of the PHP license
  12   * that is available through the world-wide-web at the following URI:
  13   * http://www.php.net/license/3_01.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_01.txt  PHP License
  22   * @version    CVS: $Id: empty-value.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  /*
  28   * If the package version number is found in the left hand
  29   * portion of the if() expression below, that means this file has
  30   * come from the PEAR installer.  Therefore, let's test the
  31   * installed version of XML_RPC which should be in the include path.
  32   * 
  33   * If the version has not been substituted in the if() expression,
  34   * this file has likely come from a CVS checkout or a .tar file.
  35   * Therefore, we'll assume the tests should use the version of
  36   * XML_RPC that has come from there as well.
  37   */
  38  if ('1.5.1' != '@'.'package_version'.'@') {
  39      /**
  40       * Get the needed class from the PEAR installation
  41       */
  42      require_once  'XML/RPC/Server.php';
  43  } else {
  44      if (substr(dirname(__FILE__), -9, -6) != 'XML') {
  45          echo "The parent directory must be named 'XML'.\n";
  46          exit;
  47      }
  48  
  49      ini_set('include_path', '../../'
  50              . PATH_SEPARATOR . '.' . PATH_SEPARATOR
  51              . ini_get('include_path')
  52      );
  53  
  54      /**
  55       * Get the needed class from the parent directory
  56       */
  57      require_once '../Server.php';
  58  }
  59  
  60  $GLOBALS['HTTP_RAW_POST_DATA'] = <<<EOPOST
  61  <?xml version="1.0"?>
  62  <methodCall>
  63   <methodName>allgot</methodName>
  64    <params>
  65     <param><value><string></string></value></param>
  66     <param><value>first</value></param>
  67     <param><value>  </value></param>
  68     <param><value></value></param>
  69    </params>
  70   </methodCall>
  71  EOPOST;
  72  
  73  $expect = <<<EOEXP
  74  <?xml version="1.0" encoding="UTF-8"?>
  75  <methodResponse>
  76  <params>
  77  <param>
  78  <value><string>param 0: ''
  79  param 1: 'first'
  80  param 2: '  '
  81  param 3: ''
  82  </string></value>
  83  </param>
  84  </params>
  85  </methodResponse>
  86  EOEXP;
  87  
  88  include  './allgot.inc';


Généré le : Sun Feb 25 14:08:00 2007 par Balluche grâce à PHPXref 0.7