Annotation of embedaddon/php/ext/soap/tests/bugs/bug36226-2.phpt, revision 1.1

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

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