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