summaryrefslogtreecommitdiff
path: root/ext/reflection/tests/ReflectionClass_isIterateable_basic.phpt
blob: 8b65b9a0bd996914816457f333608dee5db6911d (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
--TEST--
ReflectionClass::isIterateable() basic
--CREDITS--
Felix De Vliegher <felix.devliegher@gmail.com>, Marc Veldman <marc@ibuildings.nl>
--FILE--
<?php

class IteratorClass implements Iterator {
	public function __construct() { }
	public function key() {}
	public function current() {}
	function next()	{}
	function valid() {}
	function rewind() {}
}
class DerivedClass extends IteratorClass {}
class NonIterator {}

function dump_iterateable($class) {
	$reflection = new ReflectionClass($class);
	var_dump($reflection->isIterateable());
}

$classes = array("ArrayObject", "IteratorClass", "DerivedClass", "NonIterator");
foreach ($classes as $class) {
	echo "Is $class iterateable? ";
	dump_iterateable($class);
}
?>
--EXPECT--
Is ArrayObject iterateable? bool(true)
Is IteratorClass iterateable? bool(true)
Is DerivedClass iterateable? bool(true)
Is NonIterator iterateable? bool(false)