Annotation of embedaddon/php/ext/standard/tests/dir/rewinddir_variation3.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test rewinddir() function : usage variations - file pointers
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : void rewinddir([resource $dir_handle])
                      6:  * Description: Rewind dir_handle back to the start 
                      7:  * Source code: ext/standard/dir.c
                      8:  * Alias to functions: rewind
                      9:  */
                     10: 
                     11: /*
                     12:  * Pass a file pointer to rewinddir() to test behaviour
                     13:  */
                     14: 
                     15: echo "*** Testing rewinddir() : usage variations ***\n";
                     16: 
                     17: echo "\n-- Open a file using fopen --\n";
                     18: var_dump($fp = fopen(__FILE__, 'r'));
                     19: 
                     20: $result1 = fread($fp, 5);
                     21: var_dump(rewinddir($fp));
                     22: $result2 = fread($fp, 5);
                     23: 
                     24: echo "\n-- Check if rewinddir() has repositioned the file pointer --\n";
                     25: if ($result1 === $result2) {
                     26:        echo "rewinddir() works on file pointers\n";
                     27: } else {
                     28:        echo "rewinddir() does not work on file pointers\n";
                     29: }
                     30: ?>
                     31: ===DONE===
                     32: --EXPECTF--
                     33: *** Testing rewinddir() : usage variations ***
                     34: 
                     35: -- Open a file using fopen --
                     36: resource(%d) of type (stream)
                     37: 
                     38: Warning: rewinddir(): %d is not a valid Directory resource in %s on line %d
                     39: bool(false)
                     40: 
                     41: -- Check if rewinddir() has repositioned the file pointer --
                     42: rewinddir() does not work on file pointers
                     43: ===DONE===

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