summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorSara Golemon <pollita@php.net>2004-03-17 20:48:12 +0000
committerSara Golemon <pollita@php.net>2004-03-17 20:48:12 +0000
commit4341ee6061f091329cc56f1d46dab108c235a8d4 (patch)
treeb53d63c0536d232f6cc25ed869bfa5451a02d0a1 /ext
parent851c254ef8eae8752077438f8e2e54e29af9aaa8 (diff)
downloadphp-git-4341ee6061f091329cc56f1d46dab108c235a8d4.tar.gz
Userspace Directory Stream Test
Diffstat (limited to 'ext')
-rw-r--r--ext/standard/tests/file/userdirstream.phpt52
1 files changed, 52 insertions, 0 deletions
diff --git a/ext/standard/tests/file/userdirstream.phpt b/ext/standard/tests/file/userdirstream.phpt
new file mode 100644
index 0000000000..d457b1988d
--- /dev/null
+++ b/ext/standard/tests/file/userdirstream.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Directory Streams
+--FILE--
+<?php
+class test {
+ public $idx = 0;
+
+ function dir_opendir($path, $options) {
+ print "Opening\n";
+ $this->idx = 0;
+
+ return true;
+ }
+
+ function dir_readdir() {
+ $sample = array('first','second','third','fourth');
+
+ if ($this->idx >= count($sample)) return false;
+ else return $sample[$this->idx++];
+ }
+
+ function dir_rewinddir() {
+ $this->idx = 0;
+
+ return true;
+ }
+
+ function dir_closedir() {
+ print "Closing up!\n";
+
+ return true;
+ }
+}
+
+stream_wrapper_register('test', 'test');
+
+var_dump(scandir('test://example.com/path/to/test'));
+?>
+--EXPECT--
+Opening
+Closing up!
+array(4) {
+ [0]=>
+ string(5) "first"
+ [1]=>
+ string(6) "fourth"
+ [2]=>
+ string(6) "second"
+ [3]=>
+ string(5) "third"
+}
+