@@ -49,7 +49,10 @@ public function testCastModernImplementation()
49
49
);
50
50
}
51
51
52
- public function testCastNode ()
52
+ /**
53
+ * @requires PHP < 8.4
54
+ */
55
+ public function testCastNodePriorToPhp84 ()
53
56
{
54
57
$ doc = new \DOMDocument ();
55
58
$ doc ->loadXML ('<foo><bar/></foo> ' );
@@ -67,6 +70,27 @@ public function testCastNode()
67
70
);
68
71
}
69
72
73
+ /**
74
+ * @requires PHP 8.4
75
+ */
76
+ public function testCastNode ()
77
+ {
78
+ $ doc = new \DOMDocument ();
79
+ $ doc ->loadXML ('<foo><bar/></foo> ' );
80
+ $ node = $ doc ->documentElement ->firstChild ;
81
+
82
+ $ this ->assertDumpMatchesFormat (<<<'EODUMP'
83
+ DOMElement {%A
84
+ +ownerDocument: ~ ?DOMDocument
85
+ +namespaceURI: ~ ?string
86
+ +prefix: ~ string
87
+ +localName: ~ ?string
88
+ %A}
89
+ EODUMP,
90
+ $ node
91
+ );
92
+ }
93
+
70
94
/**
71
95
* @requires PHP 8.4
72
96
*/
@@ -77,9 +101,9 @@ public function testCastModernNode()
77
101
78
102
$ this ->assertDumpMatchesFormat (<<<'EODUMP'
79
103
Dom\Element {%A
80
- +baseURI: ? string
81
- +isConnected: ? bool
82
- +ownerDocument: ? ?Dom\Document
104
+ +baseURI: ~ string
105
+ +isConnected: ~ bool
106
+ +ownerDocument: ~ ?Dom\Document
83
107
%A}
84
108
EODUMP,
85
109
$ node
@@ -142,7 +166,10 @@ public function testCastHTMLDocument()
142
166
);
143
167
}
144
168
145
- public function testCastText ()
169
+ /**
170
+ * @requires PHP < 8.4
171
+ */
172
+ public function testCastTextPriorToPhp84 ()
146
173
{
147
174
$ doc = new \DOMText ('foo ' );
148
175
@@ -155,6 +182,22 @@ public function testCastText()
155
182
);
156
183
}
157
184
185
+ /**
186
+ * @requires PHP 8.4
187
+ */
188
+ public function testCastText ()
189
+ {
190
+ $ doc = new \DOMText ('foo ' );
191
+
192
+ $ this ->assertDumpMatchesFormat (<<<'EODUMP'
193
+ DOMText {%A
194
+ +wholeText: ~ string
195
+ }
196
+ EODUMP,
197
+ $ doc
198
+ );
199
+ }
200
+
158
201
/**
159
202
* @requires PHP 8.4
160
203
*/
@@ -163,14 +206,17 @@ public function testCastModernText()
163
206
$ text = \Dom \HTMLDocument::createEmpty ()->createTextNode ('foo ' );
164
207
$ this ->assertDumpMatchesFormat (<<<'EODUMP'
165
208
Dom\Text {%A
166
- +wholeText: ? string
209
+ +wholeText: ~ string
167
210
}
168
211
EODUMP,
169
212
$ text
170
213
);
171
214
}
172
215
173
- public function testCastAttr ()
216
+ /**
217
+ * @requires PHP < 8.4
218
+ */
219
+ public function testCastAttrPriorToPhp84 ()
174
220
{
175
221
$ attr = new \DOMAttr ('attr ' , 'value ' );
176
222
@@ -187,6 +233,26 @@ public function testCastAttr()
187
233
);
188
234
}
189
235
236
+ /**
237
+ * @requires PHP 8.4
238
+ */
239
+ public function testCastAttrPrior ()
240
+ {
241
+ $ attr = new \DOMAttr ('attr ' , 'value ' );
242
+
243
+ $ this ->assertDumpMatchesFormat (<<<'EODUMP'
244
+ DOMAttr {%A
245
+ +name: ~ string
246
+ +specified: ~ bool
247
+ +value: ~ string
248
+ +ownerElement: ~ ?DOMElement
249
+ +schemaTypeInfo: ~ mixed
250
+ }
251
+ EODUMP,
252
+ $ attr
253
+ );
254
+ }
255
+
190
256
/**
191
257
* @requires PHP 8.4
192
258
*/
@@ -196,17 +262,20 @@ public function testCastModernAttr()
196
262
197
263
$ this ->assertDumpMatchesFormat (<<<'EODUMP'
198
264
Dom\Attr {%A
199
- +name: ? string
200
- +value: ? string
201
- +ownerElement: ? ?Dom\Element
202
- +specified: true
265
+ +name: ~ string
266
+ +value: ~ string
267
+ +ownerElement: ~ ?Dom\Element
268
+ +specified: ~ bool
203
269
}
204
270
EODUMP,
205
271
$ attr
206
272
);
207
273
}
208
274
209
- public function testCastElement ()
275
+ /**
276
+ * @requires PHP < 8.4
277
+ */
278
+ public function testCastElementPriorToPhp84 ()
210
279
{
211
280
$ attr = new \DOMElement ('foo ' );
212
281
@@ -219,6 +288,22 @@ public function testCastElement()
219
288
);
220
289
}
221
290
291
+ /**
292
+ * @requires PHP 8.4
293
+ */
294
+ public function testCastElement ()
295
+ {
296
+ $ attr = new \DOMElement ('foo ' );
297
+
298
+ $ this ->assertDumpMatchesFormat (<<<'EODUMP'
299
+ DOMElement {%A
300
+ +tagName: ~ string
301
+ %A}
302
+ EODUMP,
303
+ $ attr
304
+ );
305
+ }
306
+
222
307
/**
223
308
* @requires PHP 8.4
224
309
*/
@@ -228,14 +313,17 @@ public function testCastModernElement()
228
313
229
314
$ this ->assertDumpMatchesFormat (<<<'EODUMP'
230
315
Dom\HTMLElement {%A
231
- +tagName: ? string
316
+ +tagName: ~ string
232
317
%A}
233
318
EODUMP,
234
319
$ attr
235
320
);
236
321
}
237
322
238
- public function testCastDocumentType ()
323
+ /**
324
+ * @requires PHP < 8.4
325
+ */
326
+ public function testCastDocumentTypePriorToPhp84 ()
239
327
{
240
328
$ implementation = new \DOMImplementation ();
241
329
$ type = $ implementation ->createDocumentType ('html ' , 'publicId ' , 'systemId ' );
@@ -254,6 +342,28 @@ public function testCastDocumentType()
254
342
);
255
343
}
256
344
345
+ /**
346
+ * @requires PHP 8.4
347
+ */
348
+ public function testCastDocumentType ()
349
+ {
350
+ $ implementation = new \DOMImplementation ();
351
+ $ type = $ implementation ->createDocumentType ('html ' , 'publicId ' , 'systemId ' );
352
+
353
+ $ this ->assertDumpMatchesFormat (<<<'EODUMP'
354
+ DOMDocumentType {%A
355
+ +name: ~ string
356
+ +entities: ~ DOMNamedNodeMap
357
+ +notations: ~ DOMNamedNodeMap
358
+ +publicId: ~ string
359
+ +systemId: ~ string
360
+ +internalSubset: ~ ?string
361
+ }
362
+ EODUMP,
363
+ $ type
364
+ );
365
+ }
366
+
257
367
/**
258
368
* @requires PHP 8.4
259
369
*/
@@ -264,19 +374,22 @@ public function testCastModernDocumentType()
264
374
265
375
$ this ->assertDumpMatchesFormat (<<<'EODUMP'
266
376
Dom\DocumentType {%A
267
- +name: ? string
268
- +entities: ? Dom\DtdNamedNodeMap
269
- +notations: ? Dom\DtdNamedNodeMap
270
- +publicId: ? string
271
- +systemId: ? string
272
- +internalSubset: ? ?string
377
+ +name: ~ string
378
+ +entities: ~ Dom\DtdNamedNodeMap
379
+ +notations: ~ Dom\DtdNamedNodeMap
380
+ +publicId: ~ string
381
+ +systemId: ~ string
382
+ +internalSubset: ~ ?string
273
383
}
274
384
EODUMP,
275
385
$ type
276
386
);
277
387
}
278
388
279
- public function testCastProcessingInstruction ()
389
+ /**
390
+ * @requires PHP < 8.4
391
+ */
392
+ public function testCastProcessingInstructionPriorToPhp84 ()
280
393
{
281
394
$ entity = new \DOMProcessingInstruction ('target ' , 'data ' );
282
395
@@ -290,6 +403,23 @@ public function testCastProcessingInstruction()
290
403
);
291
404
}
292
405
406
+ /**
407
+ * @requires PHP 8.4
408
+ */
409
+ public function testCastProcessingInstruction ()
410
+ {
411
+ $ entity = new \DOMProcessingInstruction ('target ' , 'data ' );
412
+
413
+ $ this ->assertDumpMatchesFormat (<<<'EODUMP'
414
+
10000
DOMProcessingInstruction {%A
415
+ +target: ~ string
416
+ +data: ~ string
417
+ }
418
+ EODUMP,
419
+ $ entity
420
+ );
421
+ }
422
+
293
423
/**
294
424
* @requires PHP 8.4
295
425
*/
@@ -299,16 +429,19 @@ public function testCastModernProcessingInstruction()
299
429
300
430
$ this ->assertDumpMatchesFormat (<<<'EODUMP'
301
431
Dom\ProcessingInstruction {%A
302
- +data: ? string
303
- +length: ? int
304
- +target: ? string
432
+ +data: ~ string
433
+ +length: ~ int
434
+ +target: ~ string
305
435
}
306
436
EODUMP,
307
437
$ entity
308
438
);
309
439
}
310
440
311
- public function testCastXPath ()
441
+ /**
442
+ * @requires PHP < 8.4
443
+ */
444
+ public function testCastXPathPriorToPhp84 ()
312
445
{
313
446
$ xpath = new \DOMXPath (new \DOMDocument ());
314
447
@@ -322,6 +455,23 @@ public function testCastXPath()
322
455
);
323
456
}
324
457
458
+ /**
459
+ * @requires PHP 8.4
460
+ */
461
+ public function testCastXPath ()
462
+ {
463
+ $ xpath = new \DOMXPath (new \DOMDocument ());
464
+
465
+ $ this ->assertDumpEquals (<<<'EODUMP'
466
+ DOMXPath {
467
+ +document: ~ DOMDocument
468
+ +registerNodeNamespaces: ~ bool
469
+ }
470
+ EODUMP,
471
+ $ xpath
472
+ );
473
+ }
474
+
325
475
/**
326
476
* @requires PHP 8.4
327
477
*/
@@ -331,8 +481,8 @@ public function testCastModernXPath()
331
481
332
482
$ this ->assertDumpEquals (<<<'EODUMP'
333
483
Dom\XPath {
334
- +document: ? Dom\Document
335
- +registerNodeNamespaces: ? bool
484
+ +document: ~ Dom\Document
485
+ +registerNodeNamespaces: ~ bool
336
486
}
337
487
EODUMP,
338
488
$ entity
0 commit comments