Annotation of embedaddon/php/ext/standard/tests/file/rmdir_variation3-win32.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test rmdir() function : variation: various valid and invalid paths
3: --CREDITS--
4: Dave Kelsey <d_kelsey@uk.ibm.com>
5: --SKIPIF--
6: <?php
7: if(substr(PHP_OS, 0, 3) != "WIN")
8: die("skip Only valid for Windows");
9: ?>
10: --FILE--
11: <?php
12: /* Prototype : bool rmdir(string dirname[, resource context])
13: * Description: Remove a directory
14: * Source code: ext/standard/file.c
15: * Alias to functions:
16: */
17:
18: echo "*** Testing rmdir() : variation ***\n";
19:
20: $workDir = "rmdirVar3.tmp";
21: $subDir = "aSubDir";
22: mkdir($workDir);
23: $cwd = getcwd();
24:
25: $unixifiedDir = '/'.substr(str_replace('\\','/',$cwd).'/'.$workDir.'/'.$subDir, 3);
26:
27: $dirs = array(
28: // relative
29: $workDir.'\\'.$subDir,
30: '.\\'.$workDir.'\\'.$subDir,
31: $workDir.'\\..\\'.$workDir.'\\'.$subDir,
32:
33: // relative bad path
34: $workDir.'\\..\\BADDIR\\'.$subDir,
35: 'BADDIR\\'.$subDir,
36:
37: //absolute
38: $cwd.'\\'.$workDir.'\\'.$subDir,
39: $cwd.'\\.\\'.$workDir.'\\'.$subDir,
40: $cwd.'\\'.$workDir.'\\..\\'.$workDir.'\\'.$subDir,
41:
42: //absolute bad path
43: $cwd.'\\BADDIR\\'.$subDir,
44:
45: //trailing separators
46: $workDir.'\\'.$subDir.'\\',
47: $cwd.'\\'.$workDir.'\\'.$subDir.'\\',
48:
49: // multiple separators
50: $workDir.'\\\\'.$subDir,
51: $cwd.'\\\\'.$workDir.'\\\\'.$subDir,
52:
53: // Unixified Dir
54: $unixifiedDir,
55:
56: );
57:
58:
59: foreach($dirs as $dir) {
60: mkdir($workDir.'/'.$subDir);
61: echo "-- removing $dir --\n";
62: $res = rmdir($dir);
63: if ($res === true) {
64: echo "Directory removed\n";
65: }
66: else {
67: rmdir($workDir.'/'.$subDir);
68: }
69: }
70:
71: rmdir($workDir);
72:
73: ?>
74: ===DONE===
75: --EXPECTF--
76: *** Testing rmdir() : variation ***
77: -- removing rmdirVar3.tmp\aSubDir --
78: Directory removed
79: -- removing .\rmdirVar3.tmp\aSubDir --
80: Directory removed
81: -- removing rmdirVar3.tmp\..\rmdirVar3.tmp\aSubDir --
82: Directory removed
83: -- removing rmdirVar3.tmp\..\BADDIR\aSubDir --
84:
85: Warning: rmdir(rmdirVar3.tmp\..\BADDIR\aSubDir): No such file or directory in %s on line %d
86: -- removing BADDIR\aSubDir --
87:
88: Warning: rmdir(BADDIR\aSubDir): No such file or directory in %s on line %d
89: -- removing %s\rmdirVar3.tmp\aSubDir --
90: Directory removed
91: -- removing %s\.\rmdirVar3.tmp\aSubDir --
92: Directory removed
93: -- removing %s\rmdirVar3.tmp\..\rmdirVar3.tmp\aSubDir --
94: Directory removed
95: -- removing %s\BADDIR\aSubDir --
96:
97: Warning: rmdir(%s\BADDIR\aSubDir): No such file or directory in %s on line %d
98: -- removing rmdirVar3.tmp\aSubDir\ --
99: Directory removed
100: -- removing %s\rmdirVar3.tmp\aSubDir\ --
101: Directory removed
102: -- removing rmdirVar3.tmp\\aSubDir --
103: Directory removed
104: -- removing %s\\rmdirVar3.tmp\\aSubDir --
105: Directory removed
106: -- removing /%s/rmdirVar3.tmp/aSubDir --
107: Directory removed
108: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>