@@ -22,7 +22,7 @@ public function testElementOfPrimitiveType($xsType, $phpName)
22
22
$ this ->assertEquals (
23
23
array (
24
24
'Example\ElementOne ' => array (
25
- 'xml_root_name ' => 'element-one ' ,
25
+ 'xml_root_name ' => 'ns-8ece61d2: element-one ' ,
26
26
'xml_root_namespace ' => 'http://www.example.com ' ,
27
27
'properties ' => array (
28
28
'__value ' => array (
@@ -62,7 +62,7 @@ public function testElementOfPrimitiveTypeAnon($xsType, $phpName)
62
62
$ this ->assertEquals (
63
63
array (
64
64
'Example \\ElementOne ' => array (
65
- 'xml_root_name ' => 'element-one ' ,
65
+ 'xml_root_name ' => 'ns-8ece61d2: element-one ' ,
66
66
'xml_root_namespace ' => 'http://www.example.com ' ,
67
67
'properties ' => array (
68
68
'__value ' => array (
@@ -97,23 +97,20 @@ public function testElementOfBaseType($xsType, $phpName)
97
97
98
98
$ this ->assertEquals (array (
99
99
'Example \\ElementOne ' => array (
100
- 'xml_root_name ' => 'element-one ' ,
100
+ 'xml_root_name ' => 'ns-8ece61d2: element-one ' ,
101
101
'xml_root_namespace ' => 'http://www.example.com ' ,
102
- 'properties ' =>
103
- array (
104
- '__value ' =>
105
- array (
106
- 'expose ' => true ,
107
- 'xml_value ' => true ,
108
- 'access_type ' => 'public_method ' ,
109
- 'accessor ' =>
110
- array (
111
- 'getter ' => 'value ' ,
112
- 'setter ' => 'value ' ,
113
- ),
114
- 'type ' => 'GoetasWebservices \\Xsd \\XsdToPhp \\XMLSchema \\DateTime ' ,
115
- ),
116
- ))
102
+ 'properties ' => array (
103
+ '__value ' => array (
104
+ 'expose ' => true ,
105
+ 'xml_value ' => true ,
106
+ 'access_type ' => 'public_method ' ,
107
+ 'accessor ' => array (
108
+ 'getter ' => 'value ' ,
109
+ 'setter ' => 'value ' ,
110
+ ),
111
+ 'type ' => 'GoetasWebservices \\Xsd \\XsdToPhp \\XMLSchema \\DateTime ' ,
112
+ ),
113
+ ))
117
114
), $ classes ['Example\ElementOne ' ]);
118
115
}
119
116
@@ -137,26 +134,188 @@ public function testElementOfBaseTypeAnon($xsType, $phpName)
137
134
138
135
$ this ->assertEquals (array (
139
136
'Example \\ElementOne ' => array (
140
- 'xml_root_name ' => 'element-one ' ,
137
+ 'xml_root_name ' => 'ns-8ece61d2: element-one ' ,
141
138
'xml_root_namespace ' => 'http://www.example.com ' ,
142
- 'properties ' =>
143
- array (
144
- '__value ' =>
145
- array (
146
- 'expose ' => true ,
147
- 'xml_value ' => true ,
148
- 'access_type ' => 'public_method ' ,
149
- 'accessor ' =>
150
- array (
151
- 'getter ' => 'value ' ,
152
- 'setter ' => 'value ' ,
153
- ),
154
- 'type ' => 'GoetasWebservices \\Xsd \\XsdToPhp \\XMLSchema \\DateTime ' ,
155
- ),
139
+ 'properties ' => array (
140
+ '__value ' => array (
141
+ 'expose ' => true ,
142
+ 'xml_value ' => true ,
143
+ 'access_type ' => 'public_method ' ,
144
+ 'accessor ' => array (
145
+ 'getter ' => 'value ' ,
146
+ 'setter ' => 'value ' ,
147
+ ),
148
+ 'type ' => 'GoetasWebservices \\Xsd \\XsdToPhp \\XMLSchema \\DateTime ' ,
156
149
),
150
+ ),
157
151
158
152
)
159
153
), $ classes ['Example\ElementOne ' ]);
160
154
161
155
}
162
- }
156
+
157
+ public function testUnqualifiedNsQualifiedElement ()
158
+ {
159
+ $ xsd = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
160
+ <xs:schema version="1.0"
161
+ targetNamespace="http://www.example.com"
162
+ xmlns:tns="http://www.example.com"
163
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
164
+ elementFormDefault="unqualified">
165
+
166
+ <xs:complexType name="childType">
167
+ <xs:sequence>
168
+ <xs:element name="id" type="xs:string"/>
169
+ </xs:sequence>
170
+ </xs:complexType>
171
+
172
+ <xs:element name="root">
173
+ <xs:complexType>
174
+ <xs:sequence>
175
+ <xs:element name="child" type="tns:childType" maxOccurs="unbounded"/>
176
+ <xs:element form="qualified" name="childRoot" type="tns:childType"/>
177
+ </xs:sequence>
178
+ </xs:complexType>
179
+ </xs:element>
180
+ </xs:schema>
181
+ ' ;
182
+ $ classes = $ this ->getClasses ($ xsd );
183
+
184
+ $ expected = array (
185
+ 'Example \\Root ' => array (
186
+ 'Example \\Root ' => array (
187
+ 'xml_root_name ' => 'ns-8ece61d2:root ' ,
188
+ 'xml_root_namespace ' => 'http://www.example.com ' ,
189
+ 'properties ' => array (
190
+ 'child ' => array (
191
+ 'expose ' => true ,
192
+ 'access_type ' => 'public_method ' ,
193
+ 'serialized_name ' => 'child ' ,
194
+ 'accessor ' => array (
195
+ 'getter ' => 'getChild ' ,
196
+ 'setter ' => 'setChild ' ,
197
+ ),
198
+ 'xml_list ' => array (
199
+ 'inline ' => true ,
200
+ 'entry_name ' => 'child ' ,
201
+ ),
202
+ 'type ' => 'array<Example \\ChildType> ' ,
203
+ ),
204
+ 'childRoot ' => array (
205
+ 'expose ' => true ,
206
+ 'access_type ' => 'public_method ' ,
207
+ 'serialized_name ' => 'childRoot ' ,
208
+ 'accessor ' => array (
209
+ 'getter ' => 'getChildRoot ' ,
210
+ 'setter ' => 'setChildRoot ' ,
211
+ ),
212
+ 'type ' => 'Example \\ChildType ' ,
213
+ 'xml_element ' => array (
214
+ 'namespace ' => 'http://www.example.com ' ,
215
+ ),
216
+ ),
217
+ ),
218
+ ),
219
+ ),
220
+ 'Example \\ChildType ' => array (
221
+ 'Example \\ChildType ' => array (
222
+ 'properties ' => array (
223
+ 'id ' => array (
224
+ 'expose ' => true ,
225
+ 'access_type ' => 'public_method ' ,
226
+ 'serialized_name ' => 'id ' ,
227
+ 'accessor ' => array (
228
+ 'getter ' => 'getId ' ,
229
+ 'setter ' => 'setId ' ,
230
+ ),
231
+ 'type ' => 'string ' ,
232
+ ),
233
+ ),
234
+ ),
235
+ ),
236
+ );
237
+
238
+ $ this ->assertEquals ($ expected , $ classes );
239
+ }
240
+
241
+ public function testUnqualifiedNs ()
242
+ {
243
+ $ xsd = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
244
+ <xs:schema version="1.0"
245
+ targetNamespace="http://www.example.com"
246
+ xmlns:tns="http://www.example.com"
247
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
248
+ elementFormDefault="unqualified">
249
+
250
+ <xs:complexType name="childType">
251
+ <xs:sequence>
252
+ <xs:element name="id" type="xs:string"/>
253
+ </xs:sequence>
254
+ </xs:complexType>
255
+
256
+ <xs:element name="root">
257
+ <xs:complexType>
258
+ <xs:sequence>
259
+ <xs:element name="child" type="tns:childType" maxOccurs="unbounded"/>
260
+ <xs:element name="childRoot" type="tns:childType"/>
261
+ </xs:sequence>
262
+ </xs:complexType>
263
+ </xs:element>
264
+ </xs:schema>
265
+ ' ;
266
+ $ classes = $ this ->getClasses ($ xsd );
267
+
268
+ $ expected = array (
269
+ 'Example \\Root ' => array (
270
+ 'Example \\Root ' => array (
271
+ 'xml_root_name ' => 'ns-8ece61d2:root ' ,
272
+ 'xml_root_namespace ' => 'http://www.example.com ' ,
273
+ 'properties ' => array (
274
+ 'child ' => array (
275
+ 'expose ' => true ,
276
+ 'access_type ' => 'public_method ' ,
277
+ 'serialized_name ' => 'child ' ,
278
+ 'accessor ' => array (
279
+ 'getter ' => 'getChild ' ,
280
+ 'setter ' => 'setChild ' ,
281
+ ),
282
+ 'xml_list ' => array (
283
+ 'inline ' => true ,
284
+ 'entry_name ' => 'child ' ,
285
+ ),
286
+ 'type ' => 'array<Example \\ChildType> ' ,
287
+ ),
288
+ 'childRoot ' => array (
289
+ 'expose ' => true ,
290
+ 'access_type ' => 'public_method ' ,
291
+ 'serialized_name ' => 'childRoot ' ,
292
+ 'accessor ' => array (
293
+ 'getter ' => 'getChildRoot ' ,
294
+ 'setter ' => 'setChildRoot ' ,
295
+ ),
296
+ 'type ' => 'Example \\ChildType ' ,
297
+ ),
298
+ ),
299
+ ),
300
+ ),
301
+ 'Example \\ChildType ' => array (
302
+ 'Example \\ChildType ' => array (
303
+ 'properties ' => array (
304
+ 'id ' => array (
305
+ 'expose ' => true ,
306
+ 'access_type ' => 'public_method ' ,
307
+ 'serialized_name ' => 'id ' ,
308
+ 'accessor ' => array (
309
+ 'getter ' => 'getId ' ,
310
+ 'setter ' => 'setId ' ,
311
+ ),
312
+ 'type ' => 'string ' ,
313
+ ),
314
+ ),
315
+ ),
316
+ ),
317
+ );
318
+
319
+ $ this ->assertEquals ($ expected , $ classes );
320
+ }
321
+ }
0 commit comments