summaryrefslogtreecommitdiff
path: root/ext/spl/tests/SplObjectStorage_removeAllExcept_basic.phpt
blob: 83b3e27d888292e8a5bb7f7f5ab5094eef9a49db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
--TEST--
Check that SplObjectStorage::removeUncommon functions when receiving proper input
--CREDITS--
Matthew Turland (me@matthewturland.com)
--FILE--
<?php

    $a = (object) 'a';
    $b = (object) 'b';
    $c = (object) 'c';

   $foo = new SplObjectStorage;
    $foo->attach($a);
    $foo->attach($b);

    $bar = new SplObjectStorage;
    $bar->attach($b);
    $bar->attach($c);

    $foo->removeAllExcept($bar);
    var_dump($foo->contains($a));
    var_dump($foo->contains($b));

?>
--EXPECT--
bool(false)
bool(true)