Annotation of embedaddon/php/ext/standard/tests/file/basename_variation2.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Testing basename() with various values for the suffix parameter
                      3: --SKIPIF--
                      4: <?php
                      5: if (substr(PHP_OS, 0, 3) == 'WIN') {
                      6:     die('skip non-windows only test');
                      7: }
                      8: ?>
                      9: --FILE--
                     10: <?php
                     11: 
                     12: $paths = array (
                     13: 
                     14:        "foo",
                     15:        "foo/",
                     16:     "foo\\",    
                     17:     "foo.bar",
                     18:     "foo.bar/",
                     19:     "foo.bar\\",
                     20:     "dir/foo.bar",
                     21:     "dir\\foo.bar",
                     22:     "dir with spaces/foo.bar",
                     23:     "dir with spaces\\foo.bar",
                     24: 
                     25: );
                     26: 
                     27: $suffixes = array (
                     28: 
                     29:        ".bar",
                     30:        ".b",
                     31:     ".",
                     32:     " ",
                     33:     "foo",
                     34:     "foo.bar",
                     35:     "foo/bar",
                     36:     "foo\\bar",
                     37:     "/",
                     38:     "\\",      
                     39: );
                     40: 
                     41: foreach ($paths as $path) {
                     42:        foreach ($suffixes as $suffix) {
                     43:                echo "basename for path $path, supplying suffix $suffix is:\n";
                     44:                var_dump(basename($path, $suffix));             
                     45:        }
                     46: }
                     47: 
                     48: echo "\ndone\n";
                     49: 
                     50: ?>
                     51: --EXPECT--
                     52: basename for path foo, supplying suffix .bar is:
                     53: string(3) "foo"
                     54: basename for path foo, supplying suffix .b is:
                     55: string(3) "foo"
                     56: basename for path foo, supplying suffix . is:
                     57: string(3) "foo"
                     58: basename for path foo, supplying suffix   is:
                     59: string(3) "foo"
                     60: basename for path foo, supplying suffix foo is:
                     61: string(3) "foo"
                     62: basename for path foo, supplying suffix foo.bar is:
                     63: string(3) "foo"
                     64: basename for path foo, supplying suffix foo/bar is:
                     65: string(3) "foo"
                     66: basename for path foo, supplying suffix foo\bar is:
                     67: string(3) "foo"
                     68: basename for path foo, supplying suffix / is:
                     69: string(3) "foo"
                     70: basename for path foo, supplying suffix \ is:
                     71: string(3) "foo"
                     72: basename for path foo/, supplying suffix .bar is:
                     73: string(3) "foo"
                     74: basename for path foo/, supplying suffix .b is:
                     75: string(3) "foo"
                     76: basename for path foo/, supplying suffix . is:
                     77: string(3) "foo"
                     78: basename for path foo/, supplying suffix   is:
                     79: string(3) "foo"
                     80: basename for path foo/, supplying suffix foo is:
                     81: string(3) "foo"
                     82: basename for path foo/, supplying suffix foo.bar is:
                     83: string(3) "foo"
                     84: basename for path foo/, supplying suffix foo/bar is:
                     85: string(3) "foo"
                     86: basename for path foo/, supplying suffix foo\bar is:
                     87: string(3) "foo"
                     88: basename for path foo/, supplying suffix / is:
                     89: string(3) "foo"
                     90: basename for path foo/, supplying suffix \ is:
                     91: string(3) "foo"
                     92: basename for path foo\, supplying suffix .bar is:
                     93: string(4) "foo\"
                     94: basename for path foo\, supplying suffix .b is:
                     95: string(4) "foo\"
                     96: basename for path foo\, supplying suffix . is:
                     97: string(4) "foo\"
                     98: basename for path foo\, supplying suffix   is:
                     99: string(4) "foo\"
                    100: basename for path foo\, supplying suffix foo is:
                    101: string(4) "foo\"
                    102: basename for path foo\, supplying suffix foo.bar is:
                    103: string(4) "foo\"
                    104: basename for path foo\, supplying suffix foo/bar is:
                    105: string(4) "foo\"
                    106: basename for path foo\, supplying suffix foo\bar is:
                    107: string(4) "foo\"
                    108: basename for path foo\, supplying suffix / is:
                    109: string(4) "foo\"
                    110: basename for path foo\, supplying suffix \ is:
                    111: string(3) "foo"
                    112: basename for path foo.bar, supplying suffix .bar is:
                    113: string(3) "foo"
                    114: basename for path foo.bar, supplying suffix .b is:
                    115: string(7) "foo.bar"
                    116: basename for path foo.bar, supplying suffix . is:
                    117: string(7) "foo.bar"
                    118: basename for path foo.bar, supplying suffix   is:
                    119: string(7) "foo.bar"
                    120: basename for path foo.bar, supplying suffix foo is:
                    121: string(7) "foo.bar"
                    122: basename for path foo.bar, supplying suffix foo.bar is:
                    123: string(7) "foo.bar"
                    124: basename for path foo.bar, supplying suffix foo/bar is:
                    125: string(7) "foo.bar"
                    126: basename for path foo.bar, supplying suffix foo\bar is:
                    127: string(7) "foo.bar"
                    128: basename for path foo.bar, supplying suffix / is:
                    129: string(7) "foo.bar"
                    130: basename for path foo.bar, supplying suffix \ is:
                    131: string(7) "foo.bar"
                    132: basename for path foo.bar/, supplying suffix .bar is:
                    133: string(3) "foo"
                    134: basename for path foo.bar/, supplying suffix .b is:
                    135: string(7) "foo.bar"
                    136: basename for path foo.bar/, supplying suffix . is:
                    137: string(7) "foo.bar"
                    138: basename for path foo.bar/, supplying suffix   is:
                    139: string(7) "foo.bar"
                    140: basename for path foo.bar/, supplying suffix foo is:
                    141: string(7) "foo.bar"
                    142: basename for path foo.bar/, supplying suffix foo.bar is:
                    143: string(7) "foo.bar"
                    144: basename for path foo.bar/, supplying suffix foo/bar is:
                    145: string(7) "foo.bar"
                    146: basename for path foo.bar/, supplying suffix foo\bar is:
                    147: string(7) "foo.bar"
                    148: basename for path foo.bar/, supplying suffix / is:
                    149: string(7) "foo.bar"
                    150: basename for path foo.bar/, supplying suffix \ is:
                    151: string(7) "foo.bar"
                    152: basename for path foo.bar\, supplying suffix .bar is:
                    153: string(8) "foo.bar\"
                    154: basename for path foo.bar\, supplying suffix .b is:
                    155: string(8) "foo.bar\"
                    156: basename for path foo.bar\, supplying suffix . is:
                    157: string(8) "foo.bar\"
                    158: basename for path foo.bar\, supplying suffix   is:
                    159: string(8) "foo.bar\"
                    160: basename for path foo.bar\, supplying suffix foo is:
                    161: string(8) "foo.bar\"
                    162: basename for path foo.bar\, supplying suffix foo.bar is:
                    163: string(8) "foo.bar\"
                    164: basename for path foo.bar\, supplying suffix foo/bar is:
                    165: string(8) "foo.bar\"
                    166: basename for path foo.bar\, supplying suffix foo\bar is:
                    167: string(8) "foo.bar\"
                    168: basename for path foo.bar\, supplying suffix / is:
                    169: string(8) "foo.bar\"
                    170: basename for path foo.bar\, supplying suffix \ is:
                    171: string(7) "foo.bar"
                    172: basename for path dir/foo.bar, supplying suffix .bar is:
                    173: string(3) "foo"
                    174: basename for path dir/foo.bar, supplying suffix .b is:
                    175: string(7) "foo.bar"
                    176: basename for path dir/foo.bar, supplying suffix . is:
                    177: string(7) "foo.bar"
                    178: basename for path dir/foo.bar, supplying suffix   is:
                    179: string(7) "foo.bar"
                    180: basename for path dir/foo.bar, supplying suffix foo is:
                    181: string(7) "foo.bar"
                    182: basename for path dir/foo.bar, supplying suffix foo.bar is:
                    183: string(7) "foo.bar"
                    184: basename for path dir/foo.bar, supplying suffix foo/bar is:
                    185: string(7) "foo.bar"
                    186: basename for path dir/foo.bar, supplying suffix foo\bar is:
                    187: string(7) "foo.bar"
                    188: basename for path dir/foo.bar, supplying suffix / is:
                    189: string(7) "foo.bar"
                    190: basename for path dir/foo.bar, supplying suffix \ is:
                    191: string(7) "foo.bar"
                    192: basename for path dir\foo.bar, supplying suffix .bar is:
                    193: string(7) "dir\foo"
                    194: basename for path dir\foo.bar, supplying suffix .b is:
                    195: string(11) "dir\foo.bar"
                    196: basename for path dir\foo.bar, supplying suffix . is:
                    197: string(11) "dir\foo.bar"
                    198: basename for path dir\foo.bar, supplying suffix   is:
                    199: string(11) "dir\foo.bar"
                    200: basename for path dir\foo.bar, supplying suffix foo is:
                    201: string(11) "dir\foo.bar"
                    202: basename for path dir\foo.bar, supplying suffix foo.bar is:
                    203: string(4) "dir\"
                    204: basename for path dir\foo.bar, supplying suffix foo/bar is:
                    205: string(11) "dir\foo.bar"
                    206: basename for path dir\foo.bar, supplying suffix foo\bar is:
                    207: string(11) "dir\foo.bar"
                    208: basename for path dir\foo.bar, supplying suffix / is:
                    209: string(11) "dir\foo.bar"
                    210: basename for path dir\foo.bar, supplying suffix \ is:
                    211: string(11) "dir\foo.bar"
                    212: basename for path dir with spaces/foo.bar, supplying suffix .bar is:
                    213: string(3) "foo"
                    214: basename for path dir with spaces/foo.bar, supplying suffix .b is:
                    215: string(7) "foo.bar"
                    216: basename for path dir with spaces/foo.bar, supplying suffix . is:
                    217: string(7) "foo.bar"
                    218: basename for path dir with spaces/foo.bar, supplying suffix   is:
                    219: string(7) "foo.bar"
                    220: basename for path dir with spaces/foo.bar, supplying suffix foo is:
                    221: string(7) "foo.bar"
                    222: basename for path dir with spaces/foo.bar, supplying suffix foo.bar is:
                    223: string(7) "foo.bar"
                    224: basename for path dir with spaces/foo.bar, supplying suffix foo/bar is:
                    225: string(7) "foo.bar"
                    226: basename for path dir with spaces/foo.bar, supplying suffix foo\bar is:
                    227: string(7) "foo.bar"
                    228: basename for path dir with spaces/foo.bar, supplying suffix / is:
                    229: string(7) "foo.bar"
                    230: basename for path dir with spaces/foo.bar, supplying suffix \ is:
                    231: string(7) "foo.bar"
                    232: basename for path dir with spaces\foo.bar, supplying suffix .bar is:
                    233: string(19) "dir with spaces\foo"
                    234: basename for path dir with spaces\foo.bar, supplying suffix .b is:
                    235: string(23) "dir with spaces\foo.bar"
                    236: basename for path dir with spaces\foo.bar, supplying suffix . is:
                    237: string(23) "dir with spaces\foo.bar"
                    238: basename for path dir with spaces\foo.bar, supplying suffix   is:
                    239: string(23) "dir with spaces\foo.bar"
                    240: basename for path dir with spaces\foo.bar, supplying suffix foo is:
                    241: string(23) "dir with spaces\foo.bar"
                    242: basename for path dir with spaces\foo.bar, supplying suffix foo.bar is:
                    243: string(16) "dir with spaces\"
                    244: basename for path dir with spaces\foo.bar, supplying suffix foo/bar is:
                    245: string(23) "dir with spaces\foo.bar"
                    246: basename for path dir with spaces\foo.bar, supplying suffix foo\bar is:
                    247: string(23) "dir with spaces\foo.bar"
                    248: basename for path dir with spaces\foo.bar, supplying suffix / is:
                    249: string(23) "dir with spaces\foo.bar"
                    250: basename for path dir with spaces\foo.bar, supplying suffix \ is:
                    251: string(23) "dir with spaces\foo.bar"
                    252: 
                    253: done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>