xref: /PHP-7.1/ext/spl/tests/observer_009.phpt (revision c44d7b35)
1--TEST--
2SPL: SplObjectStorage addAll/removeAll
3--FILE--
4<?php
5class Foo {}
6
7$storageA = new \SplObjectStorage();
8$storageA->attach(new \Foo);
9$storageA->attach(new \Foo);
10
11echo ("Count storage A: " . count($storageA));
12foreach ($storageA as $object) {
13        echo ' x ';
14}
15
16echo "\n";
17$storageB = clone $storageA;
18
19echo ("Count storage B: " . count($storageB));
20foreach ($storageB as $object) {
21        echo ' x ';
22}
23echo "\n";
24?>
25===DONE===
26<?php exit(0); ?>
27--EXPECTF--
28Count storage A: 2 x  x
29Count storage B: 2 x  x
30===DONE===
31