Annotation of embedaddon/php/ext/standard/tests/file/basename_basic-win32.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: basename() basic functionality
3: --SKIPIF--
4: <?php
5: if (substr(PHP_OS, 0, 3) != 'WIN') {
6: die('skip Windows only basename tests');
7: }
8: ?>
9: --FILE--
10: <?php
11:
12: $file_paths = array (
13: /* simple paths (forward slashes) */
14: "bar",
15: "/foo/bar",
16: "foo/bar",
17: "/bar",
18:
19: /* simple paths with trailing slashes (forward slashes) */
20: "bar/",
21: "/bar/",
22: "/foo/bar/",
23: "foo/bar/",
24: "/bar/",
25:
26: /* simple paths (backslashes) */
27: "bar",
28: "\\foo\\bar",
29: "foo\\bar",
30: "\\bar",
31:
32: /* simple paths with trailing slashes (backslashes) */
33: "bar\\",
34: "\\bar\\",
35: "\\foo\\bar\\",
36: "foo\\bar\\",
37: "\\bar\\",
38:
39: /* paths with numeric strings */
40: "10.5\\10.5",
41: "10.5/10.5",
42: "10.5",
43: "105",
44: "/10.5",
45: "\\10.5",
46: "10.5/",
47: "10.5\\",
48: "10/10.zip",
49: "0",
50: '0',
51:
52: /* path with spaces */
53: " ",
54: ' ',
55:
56: /* empty paths */
57: "",
58: '',
59: NULL,
60: );
61:
62: foreach ($file_paths as $file_path) {
63: var_dump(basename($file_path));
64: }
65:
66: ?>
67: --EXPECT--
68: string(3) "bar"
69: string(3) "bar"
70: string(3) "bar"
71: string(3) "bar"
72: string(3) "bar"
73: string(3) "bar"
74: string(3) "bar"
75: string(3) "bar"
76: string(3) "bar"
77: string(3) "bar"
78: string(3) "bar"
79: string(3) "bar"
80: string(3) "bar"
81: string(3) "bar"
82: string(3) "bar"
83: string(3) "bar"
84: string(3) "bar"
85: string(3) "bar"
86: string(4) "10.5"
87: string(4) "10.5"
88: string(4) "10.5"
89: string(3) "105"
90: string(4) "10.5"
91: string(4) "10.5"
92: string(4) "10.5"
93: string(4) "10.5"
94: string(6) "10.zip"
95: string(1) "0"
96: string(1) "0"
97: string(1) " "
98: string(1) " "
99: string(0) ""
100: string(0) ""
101: string(0) ""
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>