1--TEST-- 2CallbackFilterIterator 002 3--FILE-- 4<?php 5 6set_error_handler(function($errno, $errstr){ 7 echo $errstr . "\n"; 8 return true; 9}); 10 11try { 12 new CallbackFilterIterator(); 13} catch (TypeError $e) { 14 echo $e->getMessage() . "\n"; 15} 16 17try { 18 new CallbackFilterIterator(null); 19} catch (TypeError $e) { 20 echo $e->getMessage() . "\n"; 21} 22 23try { 24 new CallbackFilterIterator(new ArrayIterator(array()), null); 25} catch (TypeError $e) { 26 echo $e->getMessage() . "\n"; 27} 28 29try { 30 new CallbackFilterIterator(new ArrayIterator(array()), array()); 31} catch (TypeError $e) { 32 echo $e->getMessage() . "\n"; 33} 34 35$it = new CallbackFilterIterator(new ArrayIterator(array(1)), function() { 36 throw new Exception("some message"); 37}); 38try { 39 foreach($it as $e); 40} catch(Exception $e) { 41 echo $e->getMessage() . "\n"; 42} 43?> 44--EXPECT-- 45CallbackFilterIterator::__construct() expects exactly 2 arguments, 0 given 46CallbackFilterIterator::__construct() expects exactly 2 arguments, 1 given 47CallbackFilterIterator::__construct(): Argument #2 ($callback) must be a valid callback, no array or string given 48CallbackFilterIterator::__construct(): Argument #2 ($callback) must be a valid callback, array must have exactly two members 49some message 50