19declare(strict_types=1);
23use PHPUnit\Framework\Attributes\DataProvider;
24use PHPUnit\Framework\TestCase;
36 #[DataProvider('pathProvider')]
39 $manager = (new \ReflectionClass(ContainerManager::class))->newInstanceWithoutConstructor();
40 $method = new \ReflectionMethod(ContainerManager::class,
'normalizePath');
42 $this->assertSame($expected, $method->invoke($manager, $input));
47 yield
'file at root, no prefix' => [
'index.html',
'index.html'];
48 yield
'file at root, leading slash' => [
'/index.html',
'index.html'];
49 yield
'file at root, dot-slash' => [
'./index.html',
'index.html'];
50 yield
'file in subdir, no prefix' => [
'dir/file.html',
'dir/file.html'];
51 yield
'file in subdir, leading slash' => [
'/dir/file.html',
'dir/file.html'];
52 yield
'nested file, leading slash' => [
'/assets/css/style.css',
'assets/css/style.css'];
53 yield
'nested file, no prefix' => [
'assets/css/style.css',
'assets/css/style.css'];
54 yield
'trailing slash preserved as empty' => [
'/',
''];
55 yield
'empty input' => [
'',
''];
56 yield
'directory with trailing slash' => [
'dir/',
'dir'];
57 yield
'directory with both slashes' => [
'/dir/',
'dir'];
testNormalizePathProducesRelativePath(string $input, string $expected)
Regression for Mantis 0045580 / 0047237: paths inside ZIP containers must be stored as relative paths...