Annotation of embedaddon/php/ext/standard/tests/dir/scandir_basic.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
                      2: Test scandir() function : basic functionality 
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : array scandir(string $dir [, int $sorting_order [, resource $context]])
                      6:  * Description: List files & directories inside the specified path 
                      7:  * Source code: ext/standard/dir.c
                      8:  */
                      9: 
                     10: /*
                     11:  * Test basic functionality of scandir()
                     12:  */
                     13: 
                     14: echo "*** Testing scandir() : basic functionality ***\n";
                     15: 
                     16: // include file.inc for create_files function
                     17: include (dirname(__FILE__) . '/../file/file.inc');
                     18: 
                     19: // set up directory
                     20: $directory = dirname(__FILE__) . '/scandir_basic';
                     21: mkdir($directory);
                     22: create_files($directory, 3);
                     23: 
                     24: echo "\n-- scandir() with mandatory arguments --\n";
                     25: var_dump(scandir($directory));
                     26: 
                     27: echo "\n-- scandir() with all arguments --\n";
1.1.1.2 ! misho      28: $sorting_order = SCANDIR_SORT_DESCENDING;
1.1       misho      29: $context = stream_context_create();
                     30: var_dump(scandir($directory, $sorting_order, $context));
                     31: 
                     32: delete_files($directory, 3);
                     33: ?>
                     34: ===DONE===
                     35: --CLEAN--
                     36: <?php
                     37: $directory = dirname(__FILE__) . '/scandir_basic';
                     38: rmdir($directory);
                     39: ?>
                     40: --EXPECTF--
                     41: *** Testing scandir() : basic functionality ***
                     42: 
                     43: -- scandir() with mandatory arguments --
                     44: array(5) {
                     45:   [0]=>
                     46:   string(1) "."
                     47:   [1]=>
                     48:   string(2) ".."
                     49:   [2]=>
                     50:   string(9) "file1.tmp"
                     51:   [3]=>
                     52:   string(9) "file2.tmp"
                     53:   [4]=>
                     54:   string(9) "file3.tmp"
                     55: }
                     56: 
                     57: -- scandir() with all arguments --
                     58: array(5) {
                     59:   [0]=>
                     60:   string(9) "file3.tmp"
                     61:   [1]=>
                     62:   string(9) "file2.tmp"
                     63:   [2]=>
                     64:   string(9) "file1.tmp"
                     65:   [3]=>
                     66:   string(2) ".."
                     67:   [4]=>
                     68:   string(1) "."
                     69: }
                     70: ===DONE===

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