SplObjectStorage_removeAllExcept_basic.phpt 527 B

123456789101112131415161718192021222324252627
  1. --TEST--
  2. Check that SplObjectStorage::removeUncommon functions when receiving proper input
  3. --CREDITS--
  4. Matthew Turland (me@matthewturland.com)
  5. --FILE--
  6. <?php
  7. $a = (object) 'a';
  8. $b = (object) 'b';
  9. $c = (object) 'c';
  10. $foo = new SplObjectStorage;
  11. $foo->attach($a);
  12. $foo->attach($b);
  13. $bar = new SplObjectStorage;
  14. $bar->attach($b);
  15. $bar->attach($c);
  16. $foo->removeAllExcept($bar);
  17. var_dump($foo->contains($a));
  18. var_dump($foo->contains($b));
  19. ?>
  20. --EXPECT--
  21. bool(false)
  22. bool(true)