Annotation of embedaddon/php/ext/standard/tests/dir/scandir_variation6.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: Test scandir() function : usage variations - Wildcards in directory path
1.1.1.2 ! misho 3: --SKIPIF--
! 4: <?php
! 5: if (substr(PHP_OS, 0, 3) == 'WIN') {
! 6: die('skip.. Not valid for Windows');
! 7: }
! 8: ?>
1.1 misho 9: --FILE--
10: <?php
11: /* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
12: * Description: List files & directories inside the specified path
13: * Source code: ext/standard/dir.c
14: */
15:
16: /*
17: * Pass a directory path using wildcards as $dir argument to test how scandir() behaves
18: */
19:
20: echo "*** Testing scandir() : usage variations ***\n";
21:
22: // create the temporary directories
23: $file_path = dirname(__FILE__);
24: $dir_path = $file_path . "/scandir_variation6";
25: $sub_dir_path = $dir_path . "/sub_dir1";
26:
27: mkdir($dir_path);
28: mkdir($sub_dir_path);
29:
30: // with different wildcard characters
31:
32: echo "\n-- Wildcard = '*' --\n";
33: var_dump( scandir($file_path . "/scandir_var*") );
34: var_dump( scandir($file_path . "/*") );
35:
36: echo "\n-- Wildcard = '?' --\n";
37: var_dump( scandir($dir_path . "/sub_dir?") );
38: var_dump( scandir($dir_path . "/sub?dir1") );
39:
40: ?>
41: ===DONE===
42: --CLEAN--
43: <?php
44: $dir_path = dirname(__FILE__) . "/scandir_variation6";
45: $sub_dir_path = $dir_path . "/sub_dir1";
46:
47: rmdir($sub_dir_path);
48: rmdir($dir_path);
49: ?>
50: --EXPECTF--
51: *** Testing scandir() : usage variations ***
52:
53: -- Wildcard = '*' --
54:
55: Warning: scandir(%s/scandir_var*): failed to open dir: %s in %s on line %d
56:
57: Warning: scandir(): (errno %d): %s in %s on line %d
58: bool(false)
59:
60: Warning: scandir(%s/*): failed to open dir: %s in %s on line %d
61:
62: Warning: scandir(): (errno %d): %s in %s on line %d
63: bool(false)
64:
65: -- Wildcard = '?' --
66:
67: Warning: scandir(%s/scandir_variation6/sub_dir?): failed to open dir: %s in %s on line %d
68:
69: Warning: scandir(): (errno %d): %s in %s on line %d
70: bool(false)
71:
72: Warning: scandir(%s/scandir_variation6/sub?dir1): failed to open dir: %s in %s on line %d
73:
74: Warning: scandir(): (errno %d): %s in %s on line %d
75: bool(false)
76: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>