1--TEST--
2Check that SplObjectStorage::removeAllExcept generate a warning and returns NULL when passed non-object param
3--CREDITS--
4Matthew Turland (me@matthewturland.com)
5Based on work done at PHPNW Testfest 2009 by Simon Westcott (swestcott@gmail.com)
6--FILE--
7<?php
8
9$data_provider = array(
10   array(),
11   true,
12   "string",
13   12345,
14   1.2345,
15   NULL
16);
17
18foreach($data_provider as $input) {
19
20   $s = new SplObjectStorage();
21
22   var_dump($s->removeAllExcept($input));
23}
24
25?>
26--EXPECTF--
27Warning: SplObjectStorage::removeAllExcept() expects parameter 1 to be SplObjectStorage, array given in %s on line %d
28NULL
29
30Warning: SplObjectStorage::removeAllExcept() expects parameter 1 to be SplObjectStorage, boolean given in %s on line %d
31NULL
32
33Warning: SplObjectStorage::removeAllExcept() expects parameter 1 to be SplObjectStorage, %unicode_string_optional% given in %s on line %d
34NULL
35
36Warning: SplObjectStorage::removeAllExcept() expects parameter 1 to be SplObjectStorage, integer given in %s on line %d
37NULL
38
39Warning: SplObjectStorage::removeAllExcept() expects parameter 1 to be SplObjectStorage, double given in %s on line %d
40NULL
41
42Warning: SplObjectStorage::removeAllExcept() expects parameter 1 to be SplObjectStorage, null given in %s on line %d
43NULL
44
45