1--TEST-- 2SPL: LimitIterator check limits are valid 3--CREDITS-- 4Sean Burlington www.practicalweb.co.uk 5TestFest London May 2009 6--FILE-- 7<?php 8 $array = array(array(7,8,9),1,2,3,array(4,5,6)); 9$arrayIterator = new ArrayIterator($array); 10 11try { 12 $limitIterator = new LimitIterator($arrayIterator, -1); 13} catch (OutOfRangeException $e){ 14 print $e->getMessage(). "\n"; 15} 16 17 18try { 19 $limitIterator = new LimitIterator($arrayIterator, 0, -2); 20} catch (OutOfRangeException $e){ 21 print $e->getMessage() . "\n"; 22} 23 24try { 25 $limitIterator = new LimitIterator($arrayIterator, 0, -1); 26} catch (OutOfRangeException $e){ 27 print $e->getMessage() . "\n"; 28} 29 30 31 32?> 33===DONE=== 34--EXPECTF-- 35Parameter offset must be >= 0 36Parameter count must either be -1 or a value greater than or equal 0 37===DONE=== 38