xref: /PHP-8.3/ext/phar/tests/tar/tar_004.phpt (revision 74859783)
1--TEST--
2Phar: tar-based phar, tar phar with stub, mapPhar()
3--EXTENSIONS--
4phar
5--INI--
6phar.readonly=0
7phar.require_hash=0
8opcache.validate_timestamps=1
9--FILE--
10<?php
11include __DIR__ . '/files/tarmaker.php.inc';
12
13$fname = __DIR__ . '/tar_004.phar.tar';
14$alias = 'phar://' . $fname;
15
16$tar = new tarmaker($fname, 'none');
17$tar->init();
18$tar->addFile('tar_004.php', '<?php var_dump(__FILE__);');
19$tar->addFile('internal/file/here', "hi there!\n");
20$tar->mkDir('internal/dir');
21$tar->mkDir('dir');
22$tar->addFile('.phar/stub.php', '<?php
23Phar::mapPhar();
24var_dump("it worked");
25include "phar://" . __FILE__ . "/tar_004.php";
26');
27$tar->close();
28
29include $fname;
30?>
31--CLEAN--
32<?php
33@unlink(__DIR__ . '/tar_004.phar.tar');
34?>
35--EXPECTF--
36string(9) "it worked"
37string(%d) "phar://%star_004.phar.tar/tar_004.php"
38