Annotation of embedaddon/php/ext/standard/tests/file/glob_basic.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test glob() function: basic functions
! 3: --FILE--
! 4: <?php
! 5: /* Prototype: array glob ( string $pattern [, int $flags] );
! 6: Description: Find pathnames matching a pattern
! 7: */
! 8:
! 9: echo "*** Testing glob() : basic functions ***\n";
! 10:
! 11: $file_path = dirname(__FILE__);
! 12:
! 13: // temp dirname used here
! 14: $dirname = "$file_path/glob_basic";
! 15:
! 16: // temp dir created
! 17: mkdir($dirname);
! 18:
! 19: // temp files created
! 20: $fp = fopen("$dirname/wonder12345", "w");
! 21: fclose($fp);
! 22: $fp = fopen("$dirname/wonder.txt", "w");
! 23: fclose($fp);
! 24: $fp = fopen("$dirname/file.text", "w");
! 25: fclose($fp);
! 26:
! 27: // glob() with default arguments
! 28: sort_var_dump( glob($dirname."/*") );
! 29: sort_var_dump( glob($dirname."/*.txt") );
! 30: sort_var_dump( glob($dirname."/*.t?t") );
! 31: sort_var_dump( glob($dirname."/*.t*t") );
! 32: sort_var_dump( glob($dirname."/*.?") );
! 33: sort_var_dump( glob($dirname."/*.*") );
! 34:
! 35: echo "Done\n";
! 36:
! 37: function sort_var_dump($results) {
! 38: sort($results);
! 39: var_dump($results);
! 40: }
! 41: ?>
! 42: --CLEAN--
! 43: <?php
! 44: $file_path = dirname(__FILE__);
! 45: unlink("$file_path/glob_basic/wonder12345");
! 46: unlink("$file_path/glob_basic/wonder.txt");
! 47: unlink("$file_path/glob_basic/file.text");
! 48: rmdir("$file_path/glob_basic/");
! 49: ?>
! 50: --EXPECTF--
! 51: *** Testing glob() : basic functions ***
! 52: array(3) {
! 53: [0]=>
! 54: string(%d) "%s/glob_basic/file.text"
! 55: [1]=>
! 56: string(%d) "%s/glob_basic/wonder.txt"
! 57: [2]=>
! 58: string(%d) "%s/glob_basic/wonder12345"
! 59: }
! 60: array(1) {
! 61: [0]=>
! 62: string(%d) "%s/glob_basic/wonder.txt"
! 63: }
! 64: array(1) {
! 65: [0]=>
! 66: string(%d) "%s/glob_basic/wonder.txt"
! 67: }
! 68: array(2) {
! 69: [0]=>
! 70: string(%d) "%s/glob_basic/file.text"
! 71: [1]=>
! 72: string(%d) "%s/glob_basic/wonder.txt"
! 73: }
! 74: array(0) {
! 75: }
! 76: array(2) {
! 77: [0]=>
! 78: string(%d) "%s/glob_basic/file.text"
! 79: [1]=>
! 80: string(%d) "%s/glob_basic/wonder.txt"
! 81: }
! 82: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>