diff options
Diffstat (limited to 'ext/spl/tests/spl_limit_iterator_check_limits.phpt')
| -rw-r--r-- | ext/spl/tests/spl_limit_iterator_check_limits.phpt | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/ext/spl/tests/spl_limit_iterator_check_limits.phpt b/ext/spl/tests/spl_limit_iterator_check_limits.phpt new file mode 100644 index 0000000..ae1bc85 --- /dev/null +++ b/ext/spl/tests/spl_limit_iterator_check_limits.phpt @@ -0,0 +1,37 @@ +--TEST-- +SPL: LimitIterator check limits are valid +--CREDITS-- +Sean Burlington www.practicalweb.co.uk +TestFest London May 2009 +--FILE-- +<?php + $array = array(array(7,8,9),1,2,3,array(4,5,6)); +$arrayIterator = new ArrayIterator($array); + +try { + $limitIterator = new LimitIterator($arrayIterator, -1); +} catch (OutOfRangeException $e){ + print $e->getMessage(). "\n"; +} + + +try { + $limitIterator = new LimitIterator($arrayIterator, 0, -2); +} catch (OutOfRangeException $e){ + print $e->getMessage() . "\n"; +} + +try { + $limitIterator = new LimitIterator($arrayIterator, 0, -1); +} catch (OutOfRangeException $e){ + print $e->getMessage() . "\n"; +} + + + +?> +===DONE=== +--EXPECTF-- +Parameter offset must be >= 0 +Parameter count must either be -1 or a value greater than or equal 0 +===DONE=== |
