xref: /PHP-8.0/ext/soap/tests/schema/schema070.phpt (revision f8d79582)
1--TEST--
2SOAP XML Schema 70: Attribute with default value (attributeGroup)
3--SKIPIF--
4<?php require_once('skipif.inc'); ?>
5--FILE--
6<?php
7include "test_schema.inc";
8$schema = <<<EOF
9    <complexType name="testType">
10        <attribute name="str" type="string"/>
11        <attributeGroup ref="tns:int_group"/>
12    </complexType>
13    <attributeGroup name="int_group">
14        <attribute name="int" type="int" default="5"/>
15    </attributeGroup>
16EOF;
17test_schema($schema,'type="tns:testType"',(object)array("str"=>"str"));
18echo "ok";
19?>
20--EXPECTF--
21<?xml version="1.0" encoding="UTF-8"?>
22<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://test-uri/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:test><testParam str="str" xsi:type="ns1:testType"/></ns1:test></SOAP-ENV:Body></SOAP-ENV:Envelope>
23object(stdClass)#%d (2) {
24  ["str"]=>
25  string(3) "str"
26  ["int"]=>
27  int(5)
28}
29ok
30