Annotation of embedaddon/php/ext/standard/tests/strings/basename.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: basename() function
3: --FILE--
4: <?php
5: // simple checks
6: var_dump(basename("bar"));
7: var_dump(basename("/foo/bar"));
8: var_dump(basename("/bar"));
9:
10: // simple checks with trailing slashes
11: var_dump(basename("bar/"));
12: var_dump(basename("/foo/bar/"));
13: var_dump(basename("/bar/"));
14:
15: // suffix removal checks
16: var_dump(basename("bar.gz", ".gz"));
17: var_dump(basename("/foo/bar.gz", ".gz"));
18: var_dump(basename("/bar.gz", ".gz"));
19:
20: // suffix removal checks with trailing slashes
21: var_dump(basename("bar.gz/", ".gz"));
22: var_dump(basename("/foo/bar.gz/", ".gz"));
23: var_dump(basename("/bar.gz/", ".gz"));
24:
25: // suffix removal checks
26: var_dump(basename("/.gz", ".gz"));
27: var_dump(basename("/foo/.gz", ".gz"));
28: var_dump(basename("/.gz", ".gz"));
29:
30: // binary safe?
31: var_dump(basename("foo".chr(0)."bar"));
32: var_dump(basename("foo".chr(0)."bar.gz", ".gz"));
33: ?>
34: --EXPECT--
35: string(3) "bar"
36: string(3) "bar"
37: string(3) "bar"
38: string(3) "bar"
39: string(3) "bar"
40: string(3) "bar"
41: string(3) "bar"
42: string(3) "bar"
43: string(3) "bar"
44: string(3) "bar"
45: string(3) "bar"
46: string(3) "bar"
47: string(3) ".gz"
48: string(3) ".gz"
49: string(3) ".gz"
50: string(7) "foo bar"
51: string(7) "foo bar"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>