[config.w32] Warn that propro was discontinued
[m6w6/ext-propro] / tests / 002.phpt
1 --TEST--
2 property proxy
3 --SKIPIF--
4 <?php if (!extension_loaded("propro")) print "skip"; ?>
5 --FILE--
6 <?php
7
8 echo "Test\n";
9
10 class c {
11 private $storage = array();
12 function __get($p) {
13 $pp = new php\PropertyProxy(null, $p,
14 new php\PropertyProxy($this, "storage"));
15 return $pp;
16 }
17 function __set($p, $v) {
18 $this->storage[$p] = $v;
19 }
20 }
21
22 $c = new c;
23 $c->data["foo"] = 1;
24 var_dump(
25 isset($c->data["foo"]),
26 isset($c->data["bar"])
27 );
28
29 var_dump($c);
30
31 $c->data[] = 1;
32 $c->data[] = 2;
33 $c->data[] = 3;
34 $c->data["bar"][] = 123;
35 $c->data["bar"][] = 456;
36
37 var_dump($c);
38 unset($c->data["bar"][0]);
39
40 var_dump($c);
41
42 ?>
43 DONE
44 --EXPECTF--
45 Test
46 bool(true)
47 bool(false)
48 object(c)#%d (1) {
49 ["storage":"c":private]=>
50 array(1) {
51 ["data"]=>
52 array(1) {
53 ["foo"]=>
54 int(1)
55 }
56 }
57 }
58 object(c)#%d (1) {
59 ["storage":"c":private]=>
60 array(1) {
61 ["data"]=>
62 array(5) {
63 ["foo"]=>
64 int(1)
65 [0]=>
66 int(1)
67 [1]=>
68 int(2)
69 [2]=>
70 int(3)
71 ["bar"]=>
72 array(2) {
73 [0]=>
74 int(123)
75 [1]=>
76 int(456)
77 }
78 }
79 }
80 }
81 object(c)#%d (1) {
82 ["storage":"c":private]=>
83 array(1) {
84 ["data"]=>
85 array(5) {
86 ["foo"]=>
87 int(1)
88 [0]=>
89 int(1)
90 [1]=>
91 int(2)
92 [2]=>
93 int(3)
94 ["bar"]=>
95 array(1) {
96 [1]=>
97 int(456)
98 }
99 }
100 }
101 }
102 DONE