File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / spl / tests / spl_limit_iterator_check_limits.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:01 2012 UTC (12 years, 6 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--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===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>