mirror of
https://github.com/php/php-src.git
synced 2025-01-10 21:14:37 +08:00
Add tests for addAll/RemoveAll
This commit is contained in:
parent
98e72a7000
commit
eed64ece65
35
ext/spl/tests/observer_008.phpt
Normal file
35
ext/spl/tests/observer_008.phpt
Normal file
@ -0,0 +1,35 @@
|
||||
--TEST--
|
||||
SPL: SplObjectStorage addAll/removeAll
|
||||
--FILE--
|
||||
<?php
|
||||
class A extends SplObjectStorage { }
|
||||
|
||||
$o1 = new StdClass;
|
||||
$o2 = new StdClass;
|
||||
$o3 = new StdClass;
|
||||
|
||||
$a = new A;
|
||||
$a->attach($o1);
|
||||
$a->attach($o2);
|
||||
|
||||
$b = new SplObjectSTorage();
|
||||
$b->attach($o2);
|
||||
$b->attach($o3);
|
||||
|
||||
$a->addAll($b);
|
||||
|
||||
var_dump($a->count());
|
||||
|
||||
$a->detach($o3);
|
||||
var_dump($a->count());
|
||||
|
||||
$a->removeAll($b);
|
||||
var_dump($a->count());
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
int(3)
|
||||
int(2)
|
||||
int(1)
|
||||
===DONE===
|
Loading…
Reference in New Issue
Block a user