Annotation of embedaddon/php/ext/standard/tests/dir/scandir_variation6.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test scandir() function : usage variations - Wildcards in directory path
! 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: * Pass a directory path using wildcards as $dir argument to test how scandir() behaves
! 12: */
! 13:
! 14: echo "*** Testing scandir() : usage variations ***\n";
! 15:
! 16: // create the temporary directories
! 17: $file_path = dirname(__FILE__);
! 18: $dir_path = $file_path . "/scandir_variation6";
! 19: $sub_dir_path = $dir_path . "/sub_dir1";
! 20:
! 21: mkdir($dir_path);
! 22: mkdir($sub_dir_path);
! 23:
! 24: // with different wildcard characters
! 25:
! 26: echo "\n-- Wildcard = '*' --\n";
! 27: var_dump( scandir($file_path . "/scandir_var*") );
! 28: var_dump( scandir($file_path . "/*") );
! 29:
! 30: echo "\n-- Wildcard = '?' --\n";
! 31: var_dump( scandir($dir_path . "/sub_dir?") );
! 32: var_dump( scandir($dir_path . "/sub?dir1") );
! 33:
! 34: ?>
! 35: ===DONE===
! 36: --CLEAN--
! 37: <?php
! 38: $dir_path = dirname(__FILE__) . "/scandir_variation6";
! 39: $sub_dir_path = $dir_path . "/sub_dir1";
! 40:
! 41: rmdir($sub_dir_path);
! 42: rmdir($dir_path);
! 43: ?>
! 44: --EXPECTF--
! 45: *** Testing scandir() : usage variations ***
! 46:
! 47: -- Wildcard = '*' --
! 48:
! 49: Warning: scandir(%s/scandir_var*): failed to open dir: %s in %s on line %d
! 50:
! 51: Warning: scandir(): (errno %d): %s in %s on line %d
! 52: bool(false)
! 53:
! 54: Warning: scandir(%s/*): failed to open dir: %s in %s on line %d
! 55:
! 56: Warning: scandir(): (errno %d): %s in %s on line %d
! 57: bool(false)
! 58:
! 59: -- Wildcard = '?' --
! 60:
! 61: Warning: scandir(%s/scandir_variation6/sub_dir?): failed to open dir: %s in %s on line %d
! 62:
! 63: Warning: scandir(): (errno %d): %s in %s on line %d
! 64: bool(false)
! 65:
! 66: Warning: scandir(%s/scandir_variation6/sub?dir1): failed to open dir: %s in %s on line %d
! 67:
! 68: Warning: scandir(): (errno %d): %s in %s on line %d
! 69: bool(false)
! 70: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>