Annotation of embedaddon/php/ext/standard/tests/file/userdirstream.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Directory Streams
                      3: --FILE--
                      4: <?php
                      5: class test {
                      6:        public $idx = 0;
                      7: 
                      8:        function dir_opendir($path, $options) {
                      9:                print "Opening\n";
                     10:                $this->idx = 0;
                     11: 
                     12:                return true;
                     13:        }
                     14: 
                     15:        function dir_readdir() {
                     16:                $sample = array('first','second','third','fourth');
                     17: 
                     18:                if ($this->idx >= count($sample)) return false;
                     19:                                                                        else  return $sample[$this->idx++];
                     20:        }
                     21: 
                     22:        function dir_rewinddir() {
                     23:                $this->idx = 0;
                     24: 
                     25:                return true;
                     26:        }
                     27: 
                     28:        function dir_closedir() {
                     29:                print "Closing up!\n";
                     30: 
                     31:                return true;
                     32:        }
                     33: }
                     34: 
                     35: stream_wrapper_register('test', 'test');
                     36: 
                     37: var_dump(scandir('test://example.com/path/to/test'));
                     38: ?>
                     39: --EXPECT--
                     40: Opening
                     41: Closing up!
                     42: array(4) {
                     43:   [0]=>
                     44:   string(5) "first"
                     45:   [1]=>
                     46:   string(6) "fourth"
                     47:   [2]=>
                     48:   string(6) "second"
                     49:   [3]=>
                     50:   string(5) "third"
                     51: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>