From: Sara Golemon Date: Wed, 17 Mar 2004 20:48:12 +0000 (+0000) Subject: Userspace Directory Stream Test X-Git-Tag: php-5.0.0RC1~19 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4341ee6061f091329cc56f1d46dab108c235a8d4;p=php Userspace Directory Stream Test --- 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-- +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" +} +