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 (\ValueError $e){ 14 print $e->getMessage(). "\n"; 15} 16 17try { 18 $limitIterator = new LimitIterator($arrayIterator, 0, -2); 19} catch (\ValueError $e){ 20 print $e->getMessage() . "\n"; 21} 22 23$limitIterator = new LimitIterator($arrayIterator, 0, -1); 24 25?> 26--EXPECT-- 27LimitIterator::__construct(): Argument #2 ($offset) must be greater than or equal to 0 28LimitIterator::__construct(): Argument #3 ($limit) must be greater than or equal to -1 29