Annotation of embedaddon/php/ext/standard/tests/file/pathinfo_basic2-win32.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test pathinfo() function: basic functionality
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: mixed pathinfo ( string $path [, int $options] );
13: Description: Returns information about a file path
14: */
15:
16: echo "*** Testing basic functions of pathinfo() ***\n";
17:
18: $paths = array (
19: 'c:\..\dir1',
20: 'c:\test\..\test2\.\adir\afile.txt',
21: '/usr/include/../arpa/./inet.h',
22: 'c:\test\adir\afile..txt',
23: '/usr/include/arpa/inet..h',
24: 'c:\test\adir\afile.',
25: '/usr/include/arpa/inet.',
26: '/usr/include/arpa/inet,h',
27: 'c:afile.txt',
28: '..\.\..\test\afile.txt',
29: '.././../test/afile',
30: '.',
31: '..',
32: '...',
33: '/usr/lib/.../afile'
34:
35: );
36:
37: $counter = 1;
38: /* loop through $paths to test each $path in the above array */
39: foreach($paths as $path) {
40: echo "-- Iteration $counter --\n";
41: var_dump( pathinfo($path, PATHINFO_DIRNAME) );
42: var_dump( pathinfo($path, PATHINFO_BASENAME) );
43: var_dump( pathinfo($path, PATHINFO_EXTENSION) );
44: var_dump( pathinfo($path, PATHINFO_FILENAME) );
45: var_dump( pathinfo($path) );
46: $counter++;
47: }
48:
49: echo "Done\n";
50: ?>
51: --EXPECT--
52: *** Testing basic functions of pathinfo() ***
53: -- Iteration 1 --
54: string(5) "c:\.."
55: string(4) "dir1"
56: string(0) ""
57: string(4) "dir1"
58: array(3) {
59: ["dirname"]=>
60: string(5) "c:\.."
61: ["basename"]=>
62: string(4) "dir1"
63: ["filename"]=>
64: string(4) "dir1"
65: }
66: -- Iteration 2 --
67: string(23) "c:\test\..\test2\.\adir"
68: string(9) "afile.txt"
69: string(3) "txt"
70: string(5) "afile"
71: array(4) {
72: ["dirname"]=>
73: string(23) "c:\test\..\test2\.\adir"
74: ["basename"]=>
75: string(9) "afile.txt"
76: ["extension"]=>
77: string(3) "txt"
78: ["filename"]=>
79: string(5) "afile"
80: }
81: -- Iteration 3 --
82: string(22) "/usr/include/../arpa/."
83: string(6) "inet.h"
84: string(1) "h"
85: string(4) "inet"
86: array(4) {
87: ["dirname"]=>
88: string(22) "/usr/include/../arpa/."
89: ["basename"]=>
90: string(6) "inet.h"
91: ["extension"]=>
92: string(1) "h"
93: ["filename"]=>
94: string(4) "inet"
95: }
96: -- Iteration 4 --
97: string(12) "c:\test\adir"
98: string(10) "afile..txt"
99: string(3) "txt"
100: string(6) "afile."
101: array(4) {
102: ["dirname"]=>
103: string(12) "c:\test\adir"
104: ["basename"]=>
105: string(10) "afile..txt"
106: ["extension"]=>
107: string(3) "txt"
108: ["filename"]=>
109: string(6) "afile."
110: }
111: -- Iteration 5 --
112: string(17) "/usr/include/arpa"
113: string(7) "inet..h"
114: string(1) "h"
115: string(5) "inet."
116: array(4) {
117: ["dirname"]=>
118: string(17) "/usr/include/arpa"
119: ["basename"]=>
120: string(7) "inet..h"
121: ["extension"]=>
122: string(1) "h"
123: ["filename"]=>
124: string(5) "inet."
125: }
126: -- Iteration 6 --
127: string(12) "c:\test\adir"
128: string(6) "afile."
129: string(0) ""
130: string(5) "afile"
131: array(4) {
132: ["dirname"]=>
133: string(12) "c:\test\adir"
134: ["basename"]=>
135: string(6) "afile."
136: ["extension"]=>
137: string(0) ""
138: ["filename"]=>
139: string(5) "afile"
140: }
141: -- Iteration 7 --
142: string(17) "/usr/include/arpa"
143: string(5) "inet."
144: string(0) ""
145: string(4) "inet"
146: array(4) {
147: ["dirname"]=>
148: string(17) "/usr/include/arpa"
149: ["basename"]=>
150: string(5) "inet."
151: ["extension"]=>
152: string(0) ""
153: ["filename"]=>
154: string(4) "inet"
155: }
156: -- Iteration 8 --
157: string(17) "/usr/include/arpa"
158: string(6) "inet,h"
159: string(0) ""
160: string(6) "inet,h"
161: array(3) {
162: ["dirname"]=>
163: string(17) "/usr/include/arpa"
164: ["basename"]=>
165: string(6) "inet,h"
166: ["filename"]=>
167: string(6) "inet,h"
168: }
169: -- Iteration 9 --
170: string(3) "c:."
171: string(11) "c:afile.txt"
172: string(3) "txt"
173: string(7) "c:afile"
174: array(4) {
175: ["dirname"]=>
176: string(3) "c:."
177: ["basename"]=>
178: string(11) "c:afile.txt"
179: ["extension"]=>
180: string(3) "txt"
181: ["filename"]=>
182: string(7) "c:afile"
183: }
184: -- Iteration 10 --
185: string(12) "..\.\..\test"
186: string(9) "afile.txt"
187: string(3) "txt"
188: string(5) "afile"
189: array(4) {
190: ["dirname"]=>
191: string(12) "..\.\..\test"
192: ["basename"]=>
193: string(9) "afile.txt"
194: ["extension"]=>
195: string(3) "txt"
196: ["filename"]=>
197: string(5) "afile"
198: }
199: -- Iteration 11 --
200: string(12) ".././../test"
201: string(5) "afile"
202: string(0) ""
203: string(5) "afile"
204: array(3) {
205: ["dirname"]=>
206: string(12) ".././../test"
207: ["basename"]=>
208: string(5) "afile"
209: ["filename"]=>
210: string(5) "afile"
211: }
212: -- Iteration 12 --
213: string(1) "."
214: string(1) "."
215: string(0) ""
216: string(0) ""
217: array(4) {
218: ["dirname"]=>
219: string(1) "."
220: ["basename"]=>
221: string(1) "."
222: ["extension"]=>
223: string(0) ""
224: ["filename"]=>
225: string(0) ""
226: }
227: -- Iteration 13 --
228: string(1) "."
229: string(2) ".."
230: string(0) ""
231: string(1) "."
232: array(4) {
233: ["dirname"]=>
234: string(1) "."
235: ["basename"]=>
236: string(2) ".."
237: ["extension"]=>
238: string(0) ""
239: ["filename"]=>
240: string(1) "."
241: }
242: -- Iteration 14 --
243: string(1) "."
244: string(3) "..."
245: string(0) ""
246: string(2) ".."
247: array(4) {
248: ["dirname"]=>
249: string(1) "."
250: ["basename"]=>
251: string(3) "..."
252: ["extension"]=>
253: string(0) ""
254: ["filename"]=>
255: string(2) ".."
256: }
257: -- Iteration 15 --
258: string(12) "/usr/lib/..."
259: string(5) "afile"
260: string(0) ""
261: string(5) "afile"
262: array(3) {
263: ["dirname"]=>
264: string(12) "/usr/lib/..."
265: ["basename"]=>
266: string(5) "afile"
267: ["filename"]=>
268: string(5) "afile"
269: }
270: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>