xref: /PHP-7.3/ext/phar/tests/tar/tar_004.phpt (revision 113213f0)
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
10--FILE--
11<?php
12include dirname(__FILE__) . '/files/tarmaker.php.inc';
13
14$fname = dirname(__FILE__) . '/tar_004.phar.tar';
15$alias = 'phar://' . $fname;
16
17$tar = new tarmaker($fname, 'none');
18$tar->init();
19$tar->addFile('tar_004.php', '<?php var_dump(__FILE__);');
20$tar->addFile('internal/file/here', "hi there!\n");
21$tar->mkDir('internal/dir');
22$tar->mkDir('dir');
23$tar->addFile('.phar/stub.php', '<?php
24Phar::mapPhar();
25var_dump("it worked");
26include "phar://" . __FILE__ . "/tar_004.php";
27');
28$tar->close();
29
30include $fname;
31?>
32===DONE===
33--CLEAN--
34<?php
35@unlink(dirname(__FILE__) . '/tar_004.phar.tar');
36?>
37--EXPECTF--
38string(9) "it worked"
39string(%d) "phar://%star_004.phar.tar/tar_004.php"
40===DONE===
41