xref: /PHP-8.3/ext/tidy/tests/010.phpt (revision aeb4acac)
1--TEST--
2Accessing root, body, html, and head nodes..
3--EXTENSIONS--
4tidy
5--FILE--
6<?php
7$a = tidy_parse_string("<HTML><BODY BGCOLOR=#FFFFFF ALINK=#000000></BODY></HTML>", array('newline' => 'LF'));
8var_dump($a->root());
9var_dump($a->body());
10var_dump($a->html());
11var_dump($a->head());
12
13?>
14--EXPECTF--
15object(tidyNode)#2 (9) {
16  ["value"]=>
17  string(94) "<html>
18<head>
19<title></title>
20</head>
21<body bgcolor="#FFFFFF" alink="#000000">
22</body>
23</html>"
24  ["name"]=>
25  string(0) ""
26  ["type"]=>
27  int(0)
28  ["line"]=>
29  int(1)
30  ["column"]=>
31  int(1)
32  ["proprietary"]=>
33  bool(false)
34  ["id"]=>
35  NULL
36  ["attribute"]=>
37  NULL
38  ["child"]=>
39  array(1) {
40    [0]=>
41    object(tidyNode)#3 (9) {
42      ["value"]=>
43      string(94) "<html>
44<head>
45<title></title>
46</head>
47<body bgcolor="#FFFFFF" alink="#000000">
48</body>
49</html>"
50      ["name"]=>
51      string(4) "html"
52      ["type"]=>
53      int(5)
54      ["line"]=>
55      int(1)
56      ["column"]=>
57      int(1)
58      ["proprietary"]=>
59      bool(false)
60      ["id"]=>
61      int(48)
62      ["attribute"]=>
63      NULL
64      ["child"]=>
65      array(2) {
66        [0]=>
67        object(tidyNode)#4 (9) {
68          ["value"]=>
69          string(31) "<head>
70<title></title>
71</head>
72"
73          ["name"]=>
74          string(4) "head"
75          ["type"]=>
76          int(5)
77          ["line"]=>
78          int(1)
79          ["column"]=>
80          int(7)
81          ["proprietary"]=>
82          bool(false)
83          ["id"]=>
84          int(46)
85          ["attribute"]=>
86          NULL
87          ["child"]=>
88          array(1) {
89            [0]=>
90            object(tidyNode)#5 (9) {
91              ["value"]=>
92              string(16) "<title></title>
93"
94              ["name"]=>
95              string(5) "title"
96              ["type"]=>
97              int(5)
98              ["line"]=>
99              int(1)
100              ["column"]=>
101              int(57)
102              ["proprietary"]=>
103              bool(false)
104              ["id"]=>
105              int(%i)
106              ["attribute"]=>
107              NULL
108              ["child"]=>
109              NULL
110            }
111          }
112        }
113        [1]=>
114        object(tidyNode)#6 (9) {
115          ["value"]=>
116          string(49) "<body bgcolor="#FFFFFF" alink="#000000">
117</body>
118"
119          ["name"]=>
120          string(4) "body"
121          ["type"]=>
122          int(5)
123          ["line"]=>
124          int(1)
125          ["column"]=>
126          int(7)
127          ["proprietary"]=>
128          bool(false)
129          ["id"]=>
130          int(16)
131          ["attribute"]=>
132          array(2) {
133            ["bgcolor"]=>
134            string(7) "#FFFFFF"
135            ["alink"]=>
136            string(7) "#000000"
137          }
138          ["child"]=>
139          NULL
140        }
141      }
142    }
143  }
144}
145object(tidyNode)#2 (9) {
146  ["value"]=>
147  string(49) "<body bgcolor="#FFFFFF" alink="#000000">
148</body>
149"
150  ["name"]=>
151  string(4) "body"
152  ["type"]=>
153  int(5)
154  ["line"]=>
155  int(1)
156  ["column"]=>
157  int(7)
158  ["proprietary"]=>
159  bool(false)
160  ["id"]=>
161  int(16)
162  ["attribute"]=>
163  array(2) {
164    ["bgcolor"]=>
165    string(7) "#FFFFFF"
166    ["alink"]=>
167    string(7) "#000000"
168  }
169  ["child"]=>
170  NULL
171}
172object(tidyNode)#2 (9) {
173  ["value"]=>
174  string(94) "<html>
175<head>
176<title></title>
177</head>
178<body bgcolor="#FFFFFF" alink="#000000">
179</body>
180</html>"
181  ["name"]=>
182  string(4) "html"
183  ["type"]=>
184  int(5)
185  ["line"]=>
186  int(1)
187  ["column"]=>
188  int(1)
189  ["proprietary"]=>
190  bool(false)
191  ["id"]=>
192  int(48)
193  ["attribute"]=>
194  NULL
195  ["child"]=>
196  array(2) {
197    [0]=>
198    object(tidyNode)#3 (9) {
199      ["value"]=>
200      string(31) "<head>
201<title></title>
202</head>
203"
204      ["name"]=>
205      string(4) "head"
206      ["type"]=>
207      int(5)
208      ["line"]=>
209      int(1)
210      ["column"]=>
211      int(7)
212      ["proprietary"]=>
213      bool(false)
214      ["id"]=>
215      int(46)
216      ["attribute"]=>
217      NULL
218      ["child"]=>
219      array(1) {
220        [0]=>
221        object(tidyNode)#6 (9) {
222          ["value"]=>
223          string(16) "<title></title>
224"
225          ["name"]=>
226          string(5) "title"
227          ["type"]=>
228          int(5)
229          ["line"]=>
230          int(1)
231          ["column"]=>
232          int(57)
233          ["proprietary"]=>
234          bool(false)
235          ["id"]=>
236          int(%i)
237          ["attribute"]=>
238          NULL
239          ["child"]=>
240          NULL
241        }
242      }
243    }
244    [1]=>
245    object(tidyNode)#4 (9) {
246      ["value"]=>
247      string(49) "<body bgcolor="#FFFFFF" alink="#000000">
248</body>
249"
250      ["name"]=>
251      string(4) "body"
252      ["type"]=>
253      int(5)
254      ["line"]=>
255      int(1)
256      ["column"]=>
257      int(7)
258      ["proprietary"]=>
259      bool(false)
260      ["id"]=>
261      int(16)
262      ["attribute"]=>
263      array(2) {
264        ["bgcolor"]=>
265        string(7) "#FFFFFF"
266        ["alink"]=>
267        string(7) "#000000"
268      }
269      ["child"]=>
270      NULL
271    }
272  }
273}
274object(tidyNode)#2 (9) {
275  ["value"]=>
276  string(31) "<head>
277<title></title>
278</head>
279"
280  ["name"]=>
281  string(4) "head"
282  ["type"]=>
283  int(5)
284  ["line"]=>
285  int(1)
286  ["column"]=>
287  int(7)
288  ["proprietary"]=>
289  bool(false)
290  ["id"]=>
291  int(46)
292  ["attribute"]=>
293  NULL
294  ["child"]=>
295  array(1) {
296    [0]=>
297    object(tidyNode)#4 (9) {
298      ["value"]=>
299      string(16) "<title></title>
300"
301      ["name"]=>
302      string(5) "title"
303      ["type"]=>
304      int(5)
305      ["line"]=>
306      int(1)
307      ["column"]=>
308      int(57)
309      ["proprietary"]=>
310      bool(false)
311      ["id"]=>
312      int(%i)
313      ["attribute"]=>
314      NULL
315      ["child"]=>
316      NULL
317    }
318  }
319}
320