--TEST-- SPL: SimpleXMLIterator and overridden iterator methods() --SKIPIF-- --FILE-- Plain text. Bla bla 1. Here we have some text data. And here some more. Wow once again. Bla bla 2. Foo Bar EOF; class SXETest extends SimpleXMLIterator { function rewind() { echo __METHOD__ . "\n"; return parent::rewind(); } function valid() { echo __METHOD__ . "\n"; return parent::valid(); } function current() { echo __METHOD__ . "\n"; return parent::current(); } function key() { echo __METHOD__ . "\n"; return parent::key(); } function next() { echo __METHOD__ . "\n"; return parent::next(); } function hasChildren() { echo __METHOD__ . "\n"; return parent::hasChildren(); } function getChildren() { echo __METHOD__ . "\n"; return parent::getChildren(); } } $sxe = new SXETest($xml); $rit = new RecursiveIteratorIterator($sxe, RecursiveIteratorIterator::SELF_FIRST); foreach($rit as $data) { var_dump(get_class($data)); var_dump(trim($data)); } ?> ===DONE=== --EXPECTF-- SXETest::rewind SXETest::valid SXETest::hasChildren SXETest::valid SXETest::current string(7) "SXETest" string(10) "Bla bla 1." SXETest::getChildren SXETest::rewind SXETest::valid SXETest::hasChildren SXETest::valid SXETest::current string(7) "SXETest" string(28) "Here we have some text data." SXETest::getChildren SXETest::rewind SXETest::valid SXETest::hasChildren SXETest::valid SXETest::current string(7) "SXETest" string(19) "And here some more." SXETest::getChildren SXETest::rewind SXETest::valid SXETest::hasChildren SXETest::valid SXETest::current string(7) "SXETest" string(15) "Wow once again." SXETest::next SXETest::valid SXETest::next SXETest::valid SXETest::next SXETest::valid SXETest::next SXETest::valid SXETest::hasChildren SXETest::valid SXETest::current string(7) "SXETest" string(10) "Bla bla 2." SXETest::getChildren SXETest::rewind SXETest::valid SXETest::hasChildren SXETest::valid SXETest::current string(7) "SXETest" string(7) "Foo Bar" SXETest::next SXETest::valid SXETest::next SXETest::valid SXETest::valid ===DONE===