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

1.1       misho       1: --TEST--
                      2: Test readdir() function : basic functionality 
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : string readdir([resource $dir_handle])
                      6:  * Description: Read directory entry from dir_handle 
                      7:  * Source code: ext/standard/dir.C
                      8:  */
                      9: 
                     10: /*
                     11:  * Test basic functionality of readdir()
                     12:  */
                     13: 
                     14: echo "*** Testing readdir() : basic functionality ***\n";
                     15: 
                     16: // include the file.inc for Function: function create_files()
                     17: chdir(dirname(__FILE__));
                     18: include(dirname(__FILE__)."/../file/file.inc");
                     19: 
                     20: $path = dirname(__FILE__) . '/readdir_basic';
                     21: mkdir($path);
                     22: create_files($path, 3);
                     23: 
                     24: echo "\n-- Call readdir() with \$path argument --\n";
                     25: var_dump($dh = opendir($path));
                     26: $a = array();
                     27: while( FALSE !== ($file = readdir($dh)) ) {
                     28:        $a[] = $file;
                     29: }
                     30: sort($a);
                     31: foreach($a as $file) {
                     32:        var_dump($file);
                     33: }
                     34: 
                     35: echo "\n-- Call readdir() without \$path argument --\n";
                     36: var_dump($dh = opendir($path));
                     37: $a = array();
                     38: while( FALSE !== ( $file = readdir() ) ) {
                     39:        $a[] = $file;
                     40: }
                     41: sort($a);
                     42: foreach($a as $file) {
                     43:        var_dump($file);
                     44: }
                     45: 
                     46: delete_files($path, 3);
                     47: closedir($dh);
                     48: ?>
                     49: ===DONE===
                     50: --CLEAN--
                     51: <?php
                     52: $path = dirname(__FILE__) . '/readdir_basic';
                     53: rmdir($path);
                     54: ?>
                     55: --EXPECTF--
                     56: *** Testing readdir() : basic functionality ***
                     57: 
                     58: -- Call readdir() with $path argument --
                     59: resource(%d) of type (stream)
                     60: string(1) "."
                     61: string(2) ".."
                     62: string(9) "file1.tmp"
                     63: string(9) "file2.tmp"
                     64: string(9) "file3.tmp"
                     65: 
                     66: -- Call readdir() without $path argument --
                     67: resource(%d) of type (stream)
                     68: string(1) "."
                     69: string(2) ".."
                     70: string(9) "file1.tmp"
                     71: string(9) "file2.tmp"
                     72: string(9) "file3.tmp"
                     73: ===DONE===

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