xref: /PHP-7.0/ext/spl/tests/observer_008.phpt (revision fc1b5427)
1--TEST--
2SPL: SplObjectStorage addAll/removeAll
3--FILE--
4<?php
5class A extends SplObjectStorage { }
6
7$o1 = new StdClass;
8$o2 = new StdClass;
9$o3 = new StdClass;
10
11$a = new A;
12$a->attach($o1);
13$a->attach($o2);
14
15$b = new SplObjectSTorage();
16$b->attach($o2);
17$b->attach($o3);
18
19$a->addAll($b);
20
21var_dump($a->count());
22
23$a->detach($o3);
24var_dump($a->count());
25
26$a->removeAll($b);
27var_dump($a->count());
28?>
29===DONE===
30<?php exit(0); ?>
31--EXPECTF--
32int(3)
33int(2)
34int(1)
35===DONE===
36