Annotation of embedaddon/php/ext/spl/tests/CallbackFilterIteratorTest-002.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: CallbackFilterIterator 002
3: --FILE--
4: <?php
5:
6: set_error_handler(function($errno, $errstr){
7: echo $errstr . "\n";
8: return true;
9: });
10:
11: try {
12: new CallbackFilterIterator();
13: } catch(InvalidArgumentException $e) {
14: echo $e->getMessage() . "\n";
15: }
16:
17: try {
18: new CallbackFilterIterator(null);
19: } catch(InvalidArgumentException $e) {
20: echo $e->getMessage() . "\n";
21: }
22:
23: try {
24: new CallbackFilterIterator(new ArrayIterator(array()), null);
25: } catch(InvalidArgumentException $e) {
26: echo $e->getMessage() . "\n";
27: }
28:
29: try {
30: new CallbackFilterIterator(new ArrayIterator(array()), array());
31: } catch(InvalidArgumentException $e) {
32: echo $e->getMessage() . "\n";
33: }
34:
35: $it = new CallbackFilterIterator(new ArrayIterator(array(1)), function() {
36: throw new Exception("some message");
37: });
38: try {
39: foreach($it as $e);
40: } catch(Exception $e) {
41: echo $e->getMessage() . "\n";
42: }
43:
44: --EXPECT--
45: CallbackFilterIterator::__construct() expects exactly 2 parameters, 0 given
46: Argument 1 passed to CallbackFilterIterator::__construct() must implement interface Iterator, null given
47: CallbackFilterIterator::__construct() expects exactly 2 parameters, 1 given
48: CallbackFilterIterator::__construct() expects parameter 2 to be a valid callback, no array or string given
49: CallbackFilterIterator::__construct() expects parameter 2 to be a valid callback, array must have exactly two members
50: some message
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>