File tree Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -698,4 +698,22 @@ public function test_delete_file_for_invalid_symlink(): void
698698 $ this ->assertFalse (is_file ($ link ));
699699 $ this ->assertFalse (is_link ($ link ));
700700 }
701+
702+ public function test_normalize_path_in_phar (): void
703+ {
704+ if (\Phar::canWrite () === false ) {
705+ $ this ->markTestSkipped ('phar.readonly is enabled in php.ini. ' );
706+ }
707+
708+ $ pharFile = $ this ->fixtures . '/phar.phar ' ;
709+ $ phar = new \Phar ($ pharFile , 0 , 'phar.phar ' );
710+ $ phar ->addFile (__DIR__ . '/../../src/Filesystem/functions.php ' , 'functions.php ' );
711+ $ phar ->addFile (__DIR__ . '/../Fixtures/Phar/normalize_path.php ' , 'index.php ' );
712+ $ phar ->createDefaultStub ('index.php ' );
713+
714+ $ output = shell_exec ('php ' . $ pharFile );
715+
716+ $ this ->assertIsString ($ output );
717+ $ this ->assertStringStartsWith ('phar:// ' , $ output );
718+ }
701719}
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ require_once 'phar://phar.phar/functions.php ' ;
6+
7+ echo \Tempest \Support \Filesystem \normalize_path (__DIR__ );
Original file line number Diff line number Diff line change @@ -189,5 +189,10 @@ public static function paths(): Generator
189189 'paths ' => ['foo \\' , '\\' ],
190190 'expected ' => 'foo/ ' ,
191191 ];
192+
193+ yield 'phar prefix ' => [
194+ 'paths ' => ['phar:///home/user/file.php ' ],
195+ 'expected ' => 'phar:///home/user/file.php ' ,
196+ ];
192197 }
193198}
You can’t perform that action at this time.
0 commit comments