1--TEST--
2Test dirname() function : basic functionality
3--CREDITS--
4Dave Kelsey <d_kelsey@uk.ibm.com>
5--SKIPIF--
6<?php
7if(substr(PHP_OS, 0, 3) != "WIN")
8  die("skip Only valid for Windows");
9?>
10--FILE--
11<?php
12/* Prototype  : string dirname(string path)
13 * Description: Returns the directory name component of the path
14 * Source code: ext/standard/string.c
15 * Alias to functions:
16 */
17
18echo "*** Testing dirname() : basic functionality ***\n";
19
20
21// Initialise all required variables
22$paths = array(
23 			'',
24 			' ',
25			'c:',
26			'c:\\',
27			'c:/',
28			'afile',
29			'c:\test\afile',
30			'c:\\test\\afile',
31			'c://test//afile',
32			'c:\test\afile\\',
33			'/usr/lib/locale/en_US',
34			'//usr/lib//locale/en_US',
35			'\\',
36			'\\\\',
37			'/',
38			'//',
39			'///',
40			'/usr/lib/locale/en_US/',
41			'c:\windows/system32\drivers/etc\hosts',
42			'/usr\lib/locale\en_US',
43			'   c:\test\adir\afile.txt',
44			'c:\test\adir\afile.txt   ',
45			'   c:\test\adir\afile.txt   ',
46			'   /usr/lib/locale/en_US',
47			'/usr/lib/locale/en_US   ',
48			'   /usr/lib/locale/en_US   ',
49			' c:',
50			'		c:\test\adir\afile.txt',
51			'/usr',
52			'/usr/',
53			);
54
55foreach ($paths as $path) {
56	var_dump( dirname($path) );
57}
58
59?>
60===DONE===
61--EXPECT--
62*** Testing dirname() : basic functionality ***
63string(0) ""
64string(1) "."
65string(2) "c:"
66string(3) "c:\"
67string(3) "c:\"
68string(1) "."
69string(7) "c:\test"
70string(7) "c:\test"
71string(8) "c://test"
72string(7) "c:\test"
73string(15) "/usr/lib/locale"
74string(17) "//usr/lib//locale"
75string(1) "\"
76string(1) "\"
77string(1) "\"
78string(1) "\"
79string(1) "\"
80string(15) "/usr/lib/locale"
81string(31) "c:\windows/system32\drivers/etc"
82string(15) "/usr\lib/locale"
83string(15) "   c:\test\adir"
84string(12) "c:\test\adir"
85string(15) "   c:\test\adir"
86string(18) "   /usr/lib/locale"
87string(15) "/usr/lib/locale"
88string(18) "   /usr/lib/locale"
89string(1) "."
90string(14) "		c:\test\adir"
91string(1) "\"
92string(1) "\"
93===DONE===
94