ILIAS
trunk Revision v11.0_alpha-2662-g519ff7d528f
◀ ilDoc Overview
ilHtmlDomNodeIteratorTest.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
use
PHPUnit\Framework\TestCase
;
22
23
final
class
ilHtmlDomNodeIteratorTest
extends
TestCase
24
{
25
public
function
testDomNodeIteratorIteratesOverXhtmlDocumentNodes():
void
26
{
27
$dom =
new
DOMDocument
();
28
$dom->loadHTML(
'<body><div><p><b>phpunit</b> <i>test</i></p></div></body>'
);
29
30
$expectedElements = [
31
'body'
,
32
'div'
,
33
'p'
,
34
'b'
,
35
'#text'
,
36
'#text'
,
37
'i'
,
38
'#text'
,
39
];
40
$actualElements = [];
41
42
$iter =
new
RecursiveIteratorIterator
(
43
new
ilHtmlDomNodeIterator
($dom),
44
RecursiveIteratorIterator::SELF_FIRST
45
);
46
foreach
($iter as $element) {
48
$actualElements[] = $element->nodeName;
49
}
50
51
$this->assertSame($expectedElements, $actualElements);
52
}
53
}
DOMDocument
ilHtmlDomNodeIteratorTest
Definition:
ilHtmlDomNodeIteratorTest.php:23
ilHtmlDomNodeIterator
RecursiveIteratorIterator
TestCase
TestCase
components
ILIAS
Html
tests
ilHtmlDomNodeIteratorTest.php
Generated on Wed Sep 3 2025 23:03:11 for ILIAS by
1.8.13 (using
Doxyfile
)