Annotation of embedaddon/php/tests/classes/iterators_008.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Ensure plain userspace superclass does not override special iterator behaviour on child class.
3: --FILE--
4: <?php
5: Class C {}
6:
7: class D extends C implements Iterator {
8:
9: private $counter = 2;
10:
11: public function valid() {
12: echo __METHOD__ . "($this->counter)\n";
13: return $this->counter;
14: }
15:
16: public function next() {
17: $this->counter--;
18: echo __METHOD__ . "($this->counter)\n";
19: }
20:
21: public function rewind() {
22: echo __METHOD__ . "($this->counter)\n";
23: }
24:
25: public function current() {
26: echo __METHOD__ . "($this->counter)\n";
27: }
28:
29: public function key() {
30: echo __METHOD__ . "($this->counter)\n";
31: }
32:
33: }
34:
35: foreach (new D as $x) {}
36: ?>
37: --EXPECTF--
38: D::rewind(2)
39: D::valid(2)
40: D::current(2)
41: D::next(1)
42: D::valid(1)
43: D::current(1)
44: D::next(0)
45: D::valid(0)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>