xref: /PHP-8.2/ext/tidy/tests/036.phpt (revision aeb4acac)
1--TEST--
2Test readonly tidyNode properties
3--EXTENSIONS--
4tidy
5--FILE--
6<?php
7
8$tidy = tidy_parse_string("<HTML><BODY BGCOLOR=#FFFFFF ALINK=#000000></BODY></HTML>");
9$node = $tidy->body();
10
11try {
12    $node->value = "";
13} catch (Error $exception) {
14    echo $exception->getMessage() . "\n";
15}
16
17try {
18    $node->name = "";
19} catch (Error $exception) {
20    echo $exception->getMessage() . "\n";
21}
22
23try {
24    $node->type = 1;
25} catch (Error $exception) {
26    echo $exception->getMessage() . "\n";
27}
28
29try {
30    $node->line = 1;
31} catch (Error $exception) {
32    echo $exception->getMessage() . "\n";
33}
34
35try {
36    $node->column = 1;
37} catch (Error $exception) {
38    echo $exception->getMessage() . "\n";
39}
40
41try {
42    $node->proprietary = true;
43} catch (Error $exception) {
44    echo $exception->getMessage() . "\n";
45}
46
47try {
48    $node->id = null;
49} catch (Error $exception) {
50    echo $exception->getMessage() . "\n";
51}
52
53try {
54    $node->attribute = [];
55} catch (Error $exception) {
56    echo $exception->getMessage() . "\n";
57}
58
59try {
60    $node->child = [];
61} catch (Error $exception) {
62    echo $exception->getMessage() . "\n";
63}
64
65?>
66--EXPECT--
67Cannot modify readonly property tidyNode::$value
68Cannot modify readonly property tidyNode::$name
69Cannot modify readonly property tidyNode::$type
70Cannot modify readonly property tidyNode::$line
71Cannot modify readonly property tidyNode::$column
72Cannot modify readonly property tidyNode::$proprietary
73Cannot modify readonly property tidyNode::$id
74Cannot modify readonly property tidyNode::$attribute
75Cannot modify readonly property tidyNode::$child
76