Annotation of embedaddon/php/ext/spl/tests/arrayObject_clone_basic2.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: SPL: Cloning an instance of ArrayObject which wraps an object.
3: --FILE--
4: <?php
5: class C { }
6:
7: $c = new C;
8: $ao1 = new ArrayObject($c);
9: $c->p1 = 'new prop added to c before clone';
10:
11: $ao2 = clone $ao1;
12:
13: $c->p2 = 'new prop added to c after clone';
14: $ao1['new.ao1'] = 'new element added to ao1';
15: $ao2['new.ao2'] = 'new element added to ao2';
16: var_dump($c, $ao1, $ao2);
17: ?>
18: --EXPECTF--
19: object(C)#1 (3) {
20: ["p1"]=>
21: string(32) "new prop added to c before clone"
22: ["p2"]=>
23: string(31) "new prop added to c after clone"
24: ["new.ao1"]=>
25: string(24) "new element added to ao1"
26: }
27: object(ArrayObject)#2 (1) {
28: ["storage":"ArrayObject":private]=>
29: object(C)#1 (3) {
30: ["p1"]=>
31: string(32) "new prop added to c before clone"
32: ["p2"]=>
33: string(31) "new prop added to c after clone"
34: ["new.ao1"]=>
35: string(24) "new element added to ao1"
36: }
37: }
38: object(ArrayObject)#3 (1) {
39: ["storage":"ArrayObject":private]=>
40: array(2) {
41: ["p1"]=>
42: string(32) "new prop added to c before clone"
43: ["new.ao2"]=>
44: string(24) "new element added to ao2"
45: }
46: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>