xref: /PHP-8.0/ext/soap/tests/schema/schema085.phpt (revision f8d79582)
1--TEST--
2SOAP XML Schema 85: Extension of complex type (elements order)
3--SKIPIF--
4<?php require_once('skipif.inc'); ?>
5--FILE--
6<?php
7include "test_schema.inc";
8$schema = <<<EOF
9    <complexType name="testType2">
10        <sequence>
11            <element name="int" type="int"/>
12        </sequence>
13    </complexType>
14    <complexType name="testType">
15        <complexContent>
16            <extension base="tns:testType2">
17                <sequence>
18                    <element name="int2" type="int"/>
19                </sequence>
20            </extension>
21        </complexContent>
22    </complexType>
23EOF;
24class A {
25  public $int = 1;
26}
27
28class B extends A {
29  public $int2 = 2;
30}
31
32
33test_schema($schema,'type="tns:testType"',new B());
34echo "ok";
35?>
36--EXPECTF--
37<?xml version="1.0" encoding="UTF-8"?>
38<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://test-uri/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:test><testParam xsi:type="ns1:testType"><int xsi:type="xsd:int">1</int><int2 xsi:type="xsd:int">2</int2></testParam></ns1:test></SOAP-ENV:Body></SOAP-ENV:Envelope>
39object(stdClass)#%d (2) {
40  ["int"]=>
41  int(1)
42  ["int2"]=>
43  int(2)
44}
45ok
46