home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / PEAR / SOAP / Interop / interop_client_run.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  5.4 KB  |  178 lines

  1. <?php
  2. // this script is usefull for quickly testing stuff, use the 'pretty' file for html output
  3. //
  4. // +----------------------------------------------------------------------+
  5. // | PHP Version 4                                                        |
  6. // +----------------------------------------------------------------------+
  7. // | Copyright (c) 1997-2003 The PHP Group                                |
  8. // +----------------------------------------------------------------------+
  9. // | This source file is subject to version 2.02 of the PHP license,      |
  10. // | that is bundled with this package in the file LICENSE, and is        |
  11. // | available at through the world-wide-web at                           |
  12. // | http://www.php.net/license/2_02.txt.                                 |
  13. // | If you did not receive a copy of the PHP license and are unable to   |
  14. // | obtain it through the world-wide-web, please send a note to          |
  15. // | license@php.net so we can mail you a copy immediately.               |
  16. // +----------------------------------------------------------------------+
  17. // | Authors: Shane Caraveo <Shane@Caraveo.com>                           |
  18. // +----------------------------------------------------------------------+
  19. //
  20. // $Id: interop_client_run.php,v 1.11 2007/01/26 15:03:24 yunosh Exp $
  21. //
  22.  
  23. if (isset($_SERVER['SERVER_NAME'])) {
  24.     die("full test run cannot be done via webserver.");
  25. }
  26.  
  27. set_time_limit(0);
  28. error_reporting(E_ALL);
  29.  
  30. require 'Console/Getopt.php';
  31. require_once 'interop_client.php';
  32.  
  33. $INTEROP_LOCAL_SERVER = TRUE;// add local server to endpoints
  34.  
  35. $iop =& new Interop_Client();
  36.  
  37. // debug output
  38. $iop->show = 1;
  39. $iop->debug = 0;
  40. $iop->showFaults = 0; // used in result table output
  41. $restrict = null;
  42.  
  43. $args = Console_Getopt::getopt($_SERVER['argv'],
  44.                                'c:dehl:m:np:r:s:t:v:wq',
  45.                                array('help'));
  46. if (PEAR::isError($args)) {
  47.     echo "\n" . $args->getMessage() . "\n\n";
  48.     help();
  49.     exit;
  50. }
  51.  
  52. function help() {
  53. print <<<END
  54. interop_client_run.php [options]
  55.     -c pear|php-soap        client type (not implemented yet)
  56.     -d                      turn on debug output
  57.     -e                      fetch interop test information
  58.     -h                      this help
  59.     -l list                 comma seperated list of endpoint names to skip
  60.     -m method_name          specific soap method to test
  61.     -n                      do not save results to database
  62.     -p t|e                  print list of [t]ests or [e]ndpoints
  63.     -r string               restrict tests to those whose name starts with...
  64.     -s server_name          test a specific server
  65.     -t test_name            run a specific set of tests
  66.     -v php|soapval          run tests with specific param types (requires -t)
  67.     -w                      run wsdl tests only (requires -t)
  68.     -q                      do not run tests
  69.  
  70. END;
  71. }
  72.  
  73. function print_test_names()
  74. {
  75.     global $iop;
  76.     print "Interop tests supported:\n";
  77.     foreach ($iop->tests as $test) {
  78.         print "  $test\n";
  79.     }
  80. }
  81.  
  82. function print_endpoint_names()
  83. {
  84.     global $iop;
  85.     if (!$iop->getEndpoints($iop->currentTest)) {
  86.         die("Unable to retrieve endpoints for $iop->currentTest\n");
  87.     }
  88.     print "Interop Servers for $iop->currentTest:\n";
  89.     foreach ($iop->endpoints as $server) {
  90.         print "  $server->name\n";
  91.     }
  92. }
  93.  
  94. foreach ($args[0] as $arg) {
  95.     switch($arg[0]) {
  96.     case 'c':
  97.         $iop->client_type = $arg[1];
  98.         break;
  99.     case 'd':
  100.         $iop->debug = true;
  101.         break;
  102.     case 'e':
  103.         $iop->fetchEndpoints();
  104.         break;
  105.     case 'h':
  106.     case '--help':
  107.         help();
  108.         exit(0);
  109.     case 'l':
  110.         $iop->skipEndpointList = split(',', $arg[1]);
  111.         break;
  112.     case 'm':
  113.         $iop->testMethod = $arg[1];
  114.         break;
  115.     case 'n':
  116.         $iop->nosave = true;
  117.         break;
  118.     case 'p':
  119.         if ($arg[1] == 't') {
  120.             print_test_names();
  121.         } elseif ($arg[1] == 'e') {
  122.             if (!$iop->currentTest) {
  123.                 print "You need to specify a test with -t\n";
  124.                 exit(0);
  125.             }
  126.             print_endpoint_names();
  127.         } else {
  128.             die("invalid print argument\n");
  129.         }
  130.         exit(0);
  131.     case 'r':
  132.         $restrict = $arg[1];
  133.         break;
  134.     case 's':
  135.         $iop->specificEndpoint = $arg[1];
  136.         break;
  137.     case 't':
  138.         $iop->currentTest = $arg[1];
  139.         break;
  140.     case 'v':
  141.         if ($arg[1] != 'php' && $arg[1] != 'soapval') {
  142.             die('Incorrect value for argument v: ' . $arg[1] . "\n");
  143.         }
  144.         $iop->paramType = $arg[1];
  145.         break;
  146.     case 'w':
  147.         $iop->useWSDL = true;
  148.         break;
  149.     case 'q':
  150.         exit(0);
  151.     }
  152. }
  153.  
  154. // These are endpoints that are listed in the interop server, but do not realy
  155. // exist any longer.
  156. $bad = array('Spheon JSOAP', 'Phalanx', 'SilverStream', 'SOAPx4 (PHP)',
  157.              'Virtuoso (development)', 'Zolera SOAP Infrastructure');
  158. $iop->skipEndpointList = array_merge($iop->skipEndpointList, $bad);
  159.  
  160. if ($restrict) {
  161.     $tests = $iop->tests;
  162.     $iop->tests = array();
  163.     foreach ($tests as $test) {
  164.         if (stristr($test, $restrict)) {
  165.             $iop->tests[] = $test;
  166.         }
  167.     }
  168. }
  169.  
  170. if ($iop->currentTest) {
  171.     $iop->doTest();  // run a single set of tests using above options
  172. } else {
  173.     // $iop->doGroupTests(); // run a group of tests set in $currentTest
  174.     $iop->doTests();  // run all tests, ignore above options
  175. }
  176.  
  177. echo "done\n";
  178.