summaryrefslogtreecommitdiff
path: root/ext/spl/tests/spl_limit_iterator_check_limits.phpt
blob: 03bdb787ae4be7997a5ce956aca199e0a51e2d79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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===
--EXPECT--
Parameter offset must be >= 0
Parameter count must either be -1 or a value greater than or equal 0
===DONE===