summaryrefslogtreecommitdiff
path: root/ext/spl/tests/sxe_005.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/spl/tests/sxe_005.phpt')
-rwxr-xr-xext/spl/tests/sxe_005.phpt46
1 files changed, 46 insertions, 0 deletions
diff --git a/ext/spl/tests/sxe_005.phpt b/ext/spl/tests/sxe_005.phpt
new file mode 100755
index 0000000000..2efd0a6bee
--- /dev/null
+++ b/ext/spl/tests/sxe_005.phpt
@@ -0,0 +1,46 @@
+--TEST--
+SPL: SimpleXMLIterator and getChildren()
+--SKIPIF--
+<?php
+if (!extension_loaded("spl")) print "skip";
+if (!extension_loaded('simplexml')) print 'skip';
+if (!extension_loaded("libxml")) print "skip LibXML not present";
+if (!class_exists('RecursiveIteratorIterator')) print 'skip RecursiveIteratorIterator not available';
+?>
+--FILE--
+<?php
+
+$xml =<<<EOF
+<?xml version='1.0'?>
+<sxe>
+ <elem1/>
+ <elem2/>
+ <elem2/>
+</sxe>
+EOF;
+
+class SXETest extends SimpleXMLIterator
+{
+ function count()
+ {
+ echo __METHOD__ . "\n";
+ return parent::count();
+ }
+}
+
+$sxe = new SXETest($xml);
+
+var_dump(count($sxe));
+var_dump(count($sxe->elem1));
+var_dump(count($sxe->elem2));
+
+?>
+===DONE===
+--EXPECT--
+SXETest::count
+int(3)
+SXETest::count
+int(1)
+SXETest::count
+int(2)
+===DONE===