@@ -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,7 +206,7 @@ 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
@@ -199,11 +242,31 @@ public function testCastAttr()
199
242
200
243
$ this ->assertDumpMatchesFormat (<<<'EODUMP'
201
244
DOMAttr {%A
202
- +name: ? string
203
- +specified: ? bool
204
- +value: ? string
205
- +ownerElement: ? ?DOMElement
206
- +schemaTypeInfo: ? mixed
245
+ +name: ~ string
246
+ +specified: ~ bool
247
+ +value: ~ string
248
+ +ownerElement: ~ ?DOMElement
249
+ +schemaTypeInfo: ~ mixed
250
+ }
251
+ EODUMP,
252
+ $ attr
253
+ );
254
+ }
255
+
256
+ /**
257
+ * @requires PHP 8.4
258
+ */
259
+ public function testCastAttrPrior ()
260
+ {
261
+ $ attr = new \DOMAttr ('attr ' , 'value ' );
262
+
263
+ $ this ->assertDumpMatchesFormat (<<<'EODUMP'
264
+ DOMAttr {%A
265
+ +name: ~ string
266
+ +specified: ~ bool
267
+ +value: ~ string
268
+ +ownerElement: ~ ?DOMElement
269
+ +schemaTypeInfo: ~ mixed
207
270
}
208
271
EODUMP,
209
272
$ attr
@@ -219,17 +282,20 @@ public function testCastModernAttr()
219
282
220
283
$ this ->assertDumpMatchesFormat (<<<'EODUMP'
221
284
Dom\Attr {%A
222
- +name: ? string
223
- +value: ? string
224
- +ownerElement: ? ?Dom\Element
225
- +specified: ? bool
285
+ +name: ~ string
286
+ +value: ~ string
287
+ +ownerElement: ~ ?Dom\Element
288
+ +specified: ~ bool
226
289
}
227
290
EODUMP,
228
291
$ attr
229
292
);
230
293
}
231
294
232
- public function testCastElement ()
295
+ /**
296
+ * @requires PHP < 8.4
297
+ */
298
+ public function testCastElementPriorToPhp84 ()
233
299
{
234
300
$ attr = new \DOMElement ('foo ' );
235
301
@@ -242,6 +308,22 @@ public function testCastElement()
242
308
);
243
309
}
244
310
311
+ /**
312
+ * @requires PHP 8.4
313
+ */
314
+ public function testCastElement ()
315
+ {
316
+ $ attr = new \DOMElement ('foo ' );
317
+
318
+ $ this ->assertDumpMatchesFormat (<<<'EODUMP'
319
+ DOMElement {%A
320
+ +tagName: ~ string
321
+ %A}
322
+ EODUMP,
323
+ $ attr
324
+ );
325
+ }
326
+
245
327
/**
246
328
* @requires PHP 8.4
247
329
*/
@@ -251,14 +333,17 @@ public function testCastModernElement()
251
333
252
334
$ this ->assertDumpMatchesFormat (<<<'EODUMP'
253
335
Dom\HTMLElement {%A
254
- +tagName: ? string
336
+ +tagName: ~ string
255
337
%A}
256
338
EODUMP,
257
339
$ attr
258
340
);
259
341
}
260
342
261
- public function testCastDocumentType ()
343
+ /**
344
+ * @requires PHP < 8.4
345
+ */
346
+ public function testCastDocumentTypePriorToPhp84 ()
262
347
{
263
348
$ implementation = new \DOMImplementation ();
264
349
$ type = $ implementation ->createDocumentType ('html ' , 'publicId ' , 'systemId ' );
@@ -277,6 +362,28 @@ public function testCastDocumentType()
277
362
);
278
363
}
279
364
365
+ /**
366
+ * @requires PHP 8.4
367
+ */
368
+ public function testCastDocumentType ()
369
+ {
370
+ $ implementation = new \DOMImplementation ();
371
+ $ type = $ implementation ->createDocumentType ('html ' , 'publicId ' , 'systemId ' );
372
+
373
+ $ this ->assertDumpMatchesFormat (<<<'EODUMP'
374
+ DOMDocumentType {%A
375
+ +name: ~ string
376
+ +entities: ~ DOMNamedNodeMap
377
+ +notations: ~ DOMNamedNodeMap
378
+ +publicId: ~ string
379
+ +systemId: ~ string
380
+ +internalSubset: ~ ?string
381
+ }
382
+ EODUMP,
383
+ $ type
384
+ );
385
+ }
386
+
280
387
/**
281
388
* @requires PHP 8.4
282
389
*/
@@ -287,19 +394,22 @@ public function testCastModernDocumentType()
287
394
288
395
$ this ->assertDumpMatchesFormat (<<<'EODUMP'
289
396
Dom\DocumentType {%A
290
- +name: ? string
291
- +entities: ? Dom\DtdNamedNodeMap
292
- +notations: ? Dom\DtdNamedNodeMap
293
- +publicId: ? string
294
- +systemId: ? string
295
- +internalSubset: ? ?string
397
+ +name: ~ string
398
+ +entities: ~ Dom\DtdNamedNodeMap
399
+ +notations: ~ Dom\DtdNamedNodeMap
400
+ +publicId: ~ string
401
+ +systemId: ~ string
402
+ +internalSubset: ~ ?string
296
403
}
297
404
EODUMP,
298
405
$ type
299
406
);
300
407
}
301
408
302
- public function testCastProcessingInstruction ()
409
+ /**
410
+ * @requires PHP < 8.4
411
+ */
412
+ public function testCastProcessingInstructionPriorToPhp84 ()
303
413
{
304
414
$ entity = new \DOMProcessingInstruction ('target ' , 'data ' );
305
415
@@ -313,6 +423,23 @@ public function testCastProcessingInstruction()
313
423
);
314
424
}
315
425
426
+ /**
427
+ * @requires PHP 8.4
428
+ */
429
+ public function testCastProcessingInstruction ()
430
+ {
431
+ $ entity = new \DOMProcessingInstruction ('target ' , 'data ' );
432
+
433
+ $ this ->assertDumpMatchesFormat (<<<'EODUMP'
434
+ DOMProcessingInstruction {%A
435
+ +target: ~ string
436
+ +data: ~ string
437
+ }
438
+ EODUMP,
439
+ $ entity
440
+ );
441
+ }
442
+
316
443
/**
317
444
* @requires PHP 8.4
318
445
*/
@@ -322,16 +449,19 @@ public function testCastModernProcessingInstruction()
322
449
323
450
$ this ->assertDumpMatchesFormat (<<<'EODUMP'
324
451
Dom\ProcessingInstruction {%A
325
- +data: ? string
326
- +length: ? int
327
- +target: ? string
452
+ +data: ~ string
453
+ +length: ~ int
454
+ +target: ~ string
328
455
}
329
456
EODUMP,
330
457
$ entity
331
458
);
332
459
}
333
460
334
- public function testCastXPath ()
461
+ /**
462
+ * @requires PHP < 8.4
463
+ */
464
+ public function testCastXPathPriorToPhp84 ()
335
465
{
336
466
$ xpath = new \DOMXPath (new \DOMDocument ());
337
467
@@ -345,6 +475,23 @@ public function testCastXPath()
345
475
);
346
476
}
347
477
478
+ /**
479
+ * @requires PHP 8.4
480
+ */
481
+ public function testCastXPath ()
482
+ {
483
+ $ xpath = new \DOMXPath (new \DOMDocument ());
484
+
485
+ $ this ->assertDumpEquals (<<<'EODUMP'
486
+ DOMXPath {
487
+ +document: ~ DOMDocument
488
+ +registerNodeNamespaces: ~ bool
489
+ }
490
+ EODUMP,
491
+ $ xpath
492
+ );
493
+ }
494
+
348
495
/**
349
496
* @requires PHP 8.4
350
497
*/
@@ -354,8 +501,8 @@ public function testCastModernXPath()
354
501
355
502
$ this ->assertDumpEquals (<<<'EODUMP'
356
503
Dom\XPath {
357
- +document: ? Dom\Document
358
- +registerNodeNamespaces: ? bool
504
+ +document: ~ Dom\Document
505
+ +registerNodeNamespaces: ~ bool
359
506
}
360
507
EODUMP,
361
508
$ entity