]> granicus.if.org Git - php/commitdiff
- MFH Add new tests
authorMarcus Boerger <helly@php.net>
Mon, 6 Feb 2006 01:28:12 +0000 (01:28 +0000)
committerMarcus Boerger <helly@php.net>
Mon, 6 Feb 2006 01:28:12 +0000 (01:28 +0000)
ext/spl/tests/array_020.phpt [new file with mode: 0755]
ext/spl/tests/bug36287.phpt [new file with mode: 0755]

diff --git a/ext/spl/tests/array_020.phpt b/ext/spl/tests/array_020.phpt
new file mode 100755 (executable)
index 0000000..cdeb4a2
--- /dev/null
@@ -0,0 +1,66 @@
+--TEST--
+SPL: ArrayIterator overloading
+--SKIPIF--
+<?php if (!extension_loaded("spl")) print "skip"; ?>
+--FILE--
+<?php
+
+class ArrayIteratorEx extends ArrayIterator
+{
+       function rewind()
+       {
+               echo __METHOD__ . "\n";
+               ArrayIterator::rewind();
+       }
+
+       function valid()
+       {
+               echo __METHOD__ . "\n";
+               return ArrayIterator::valid();
+       }
+
+       function key()
+       {
+               echo __METHOD__ . "\n";
+               return ArrayIterator::key();
+       }
+
+       function current()
+       {
+               echo __METHOD__ . "\n";
+               return ArrayIterator::current();
+       }
+
+       function next()
+       {
+               echo __METHOD__ . "\n";
+               return ArrayIterator::next();
+       }
+}
+
+$ar = new ArrayIteratorEx(array(1,2));
+foreach($ar as $k => $v)
+{
+       var_dump($k);
+       var_dump($v);
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+ArrayIteratorEx::rewind
+ArrayIteratorEx::valid
+ArrayIteratorEx::current
+ArrayIteratorEx::key
+int(0)
+int(1)
+ArrayIteratorEx::next
+ArrayIteratorEx::valid
+ArrayIteratorEx::current
+ArrayIteratorEx::key
+int(1)
+int(2)
+ArrayIteratorEx::next
+ArrayIteratorEx::valid
+===DONE===
diff --git a/ext/spl/tests/bug36287.phpt b/ext/spl/tests/bug36287.phpt
new file mode 100755 (executable)
index 0000000..dc04e11
--- /dev/null
@@ -0,0 +1,38 @@
+--TEST--
+Bug #36287
+--FILE--
+<?php
+
+$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator("."), true);
+
+$idx = 0;
+foreach($it as $file)
+{
+       echo "First\n";
+       if("." != $file && ".." != $file)
+       {
+               var_Dump($file->getFilename());
+       }
+       echo "Second\n";
+       if($file != "." && $file != "..")
+       {
+               var_dump($file->getFilename());
+       }
+       if (++$idx > 1)
+       {
+               break;
+       }
+}
+
+?>
+===DONE===
+--EXPECTF--
+First
+string(%d) "%s"
+Second
+string(%d) "%s"
+First
+string(%d) "%s"
+Second
+string(%d) "%s"
+===DONE===