Annotation of embedaddon/php/ext/soap/tests/bugs/bug36226.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Bug #36226 (SOAP Inconsistent handling when passing potential arrays)
                      3: --SKIPIF--
                      4: <?php require_once('skipif.inc'); ?>
                      5: --INI--
                      6: soap.wsdl_cache_enabled=0
                      7: --FILE--
                      8: <?php
                      9: ini_set("soap.wsdl_cache_enabled",0);
                     10: $timestamp = "2005-11-08T11:22:07+03:00";
                     11: $wsdl = dirname(__FILE__)."/bug35142.wsdl";
                     12: 
                     13: function PostEvents($x) {
                     14:        var_dump($x);
                     15:        exit();
                     16:   return $x;
                     17: }
                     18: 
                     19: class TestSoapClient extends SoapClient {
                     20: 
                     21:   function __construct($wsdl, $options) {
                     22:     parent::__construct($wsdl, $options);
                     23:     $this->server = new SoapServer($wsdl, $options);
                     24:     $this->server->addFunction('PostEvents');
                     25:   }
                     26: 
                     27:   function __doRequest($request, $location, $action, $version, $one_way = 0) {
                     28:                echo "$request\n";
                     29:     $this->server->handle($request);
                     30:     return $response;
                     31:   }
                     32: 
                     33: }
                     34: 
                     35: $soapClient = new TestSoapClient($wsdl, 
                     36:        array('trace' => 1, 'exceptions' => 0,
                     37:                'classmap' => array('logOnEvent' => 'LogOnEvent',
                     38:                        'logOffEvent' => 'LogOffEvent',
                     39:                        'events' => 'IVREvents'),
                     40:                'features' => SOAP_SINGLE_ELEMENT_ARRAYS));
                     41: 
                     42: $logOnEvent = new LogOnEvent(34567, $timestamp);
                     43: $logOffEvents[] = new LogOffEvent(34567, $timestamp, "Smoked");
                     44: $logOffEvents[] = new LogOffEvent(34568, $timestamp, "SmokeFree");
                     45: $ivrEvents = new IVREvents("1.0", 101, 12345, 'IVR', $logOnEvent, $logOffEvents);
                     46: 
                     47: $result = $soapClient->PostEvents($ivrEvents);
                     48: 
                     49: class LogOffEvent {
                     50:   public $audienceMemberId;
                     51:   public $timestamp;
                     52:   public $smokeStatus;
                     53:   public $callInitiator;
                     54: 
                     55:   function __construct($audienceMemberId, $timestamp, $smokeStatus) {
                     56:     $this->audienceMemberId = $audienceMemberId;
                     57:     $this->timestamp = $timestamp;
                     58:     $this->smokeStatus = $smokeStatus;
                     59:     $this->callInitiator = "IVR";
                     60:   }
                     61: }
                     62: 
                     63: class LogOnEvent {
                     64:   public $audienceMemberId;
                     65:   public $timestamp;
                     66: 
                     67:   function __construct($audienceMemberId, $timestamp) {
                     68:     $this->audienceMemberId = $audienceMemberId;
                     69:     $this->timestamp = $timestamp;
                     70:   }
                     71: }
                     72: 
                     73: class IVREvents {
                     74:   public $version;
                     75:   public $activityId;
                     76:   public $messageId;
                     77:   public $source;
                     78:   public $logOnEvent;
                     79:   public $logOffEvent;
                     80: 
                     81:   function __construct($version, $activityId, $messageId, $source, $logOnEvent=NULL, $logOffEvent=NULL) {
                     82:     $this->version = $version;
                     83:     $this->activityId = $activityId;
                     84:     $this->messageId = $messageId;
                     85:     $this->source = $source;
                     86:     $this->logOnEvent = $logOnEvent;
                     87:     $this->logOffEvent = $logOffEvent;
                     88:   }
                     89: }
                     90: ?>
                     91: --EXPECTF--
                     92: <?xml version="1.0" encoding="UTF-8"?>
                     93: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://testurl/Message"><SOAP-ENV:Body><ns1:ivrEvents version="1.0" activityId="101" messageId="12345" source="IVR"><ns1:logOffEvent audienceMemberId="34567" timestamp="2005-11-08T11:22:07+03:00" smokeStatus="Smoked" callInitiator="IVR"/><ns1:logOffEvent audienceMemberId="34568" timestamp="2005-11-08T11:22:07+03:00" smokeStatus="SmokeFree" callInitiator="IVR"/><ns1:logOnEvent audienceMemberId="34567" timestamp="2005-11-08T11:22:07+03:00"/></ns1:ivrEvents></SOAP-ENV:Body></SOAP-ENV:Envelope>
                     94: 
                     95: object(IVREvents)#%d (6) {
                     96:   ["version"]=>
                     97:   string(3) "1.0"
                     98:   ["activityId"]=>
                     99:   int(101)
                    100:   ["messageId"]=>
                    101:   int(12345)
                    102:   ["source"]=>
                    103:   string(3) "IVR"
                    104:   ["logOnEvent"]=>
                    105:   array(1) {
                    106:     [0]=>
                    107:     object(LogOnEvent)#10 (2) {
                    108:       ["audienceMemberId"]=>
                    109:       int(34567)
                    110:       ["timestamp"]=>
                    111:       string(25) "2005-11-08T11:22:07+03:00"
                    112:     }
                    113:   }
                    114:   ["logOffEvent"]=>
                    115:   array(2) {
                    116:     [0]=>
                    117:     object(LogOffEvent)#%d (4) {
                    118:       ["audienceMemberId"]=>
                    119:       int(34567)
                    120:       ["timestamp"]=>
                    121:       string(25) "2005-11-08T11:22:07+03:00"
                    122:       ["smokeStatus"]=>
                    123:       string(6) "Smoked"
                    124:       ["callInitiator"]=>
                    125:       string(3) "IVR"
                    126:     }
                    127:     [1]=>
                    128:     object(LogOffEvent)#%d (4) {
                    129:       ["audienceMemberId"]=>
                    130:       int(34568)
                    131:       ["timestamp"]=>
                    132:       string(25) "2005-11-08T11:22:07+03:00"
                    133:       ["smokeStatus"]=>
                    134:       string(9) "SmokeFree"
                    135:       ["callInitiator"]=>
                    136:       string(3) "IVR"
                    137:     }
                    138:   }
                    139: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>