1--TEST--
2SPL: SplFileInfo::getBasename() basic test
3--FILE--
4<?php
5// without $suffix
6echo (new \SplFileInfo('/path/to/a.txt'))->getBasename() . PHP_EOL;
7echo (new \SplFileInfo('path/to/b'))->getBasename() . PHP_EOL;
8echo (new \SplFileInfo('c.txt'))->getBasename() . PHP_EOL;
9echo (new \SplFileInfo('d'))->getBasename() . PHP_EOL;
10echo (new \SplFileInfo('~/path/to//e'))->getBasename() . PHP_EOL . PHP_EOL;
11
12// with $suffix
13echo (new \SplFileInfo('path/to/a.txt'))->getBasename('.txt') . PHP_EOL;
14echo (new \SplFileInfo('path/to/bbb.txt'))->getBasename('b.txt') . PHP_EOL;
15echo (new \SplFileInfo('path/to/ccc.txt'))->getBasename('to/ccc.txt') . PHP_EOL;
16echo (new \SplFileInfo('d.txt'))->getBasename('txt') . PHP_EOL;
17echo (new \SplFileInfo('e.txt'))->getBasename('e.txt') . PHP_EOL;
18echo (new \SplFileInfo('f'))->getBasename('.txt');
19?>
20--EXPECT--
21a.txt
22b
23c.txt
24d
25e
26
27a
28bb
29ccc.txt
30d.
31e.txt
32f
33