xref: /PHP-7.4/ext/spl/tests/iterator_count.phpt (revision e97d5fab)
1--TEST--
2SPL: iterator_count() exceptions test
3--CREDITS--
4Lance Kesson jac_kesson@hotmail.com
5#testfest London 2009-05-09
6--FILE--
7<?php
8$array=array('a','b');
9
10$iterator = new ArrayIterator($array);
11
12iterator_count();
13
14
15iterator_count($iterator,'1');
16
17iterator_count('1');
18
19
20?>
21--EXPECTF--
22Warning: iterator_count() expects exactly 1 parameter, 0 given in %s
23
24Warning: iterator_count() expects exactly 1 parameter, 2 given in %s
25
26Fatal error: Uncaught TypeError: Argument 1 passed to iterator_count() must implement interface Traversable, string given in %s:%d
27Stack trace:
28#0 %s(%d): iterator_count('1')
29#1 {main}
30  thrown in %s on line %d
31