xref: /PHP-7.2/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");
6if (!extension_loaded("spl")) die("skip SPL not available");
7?>
8--INI--
9phar.readonly=0
10phar.require_hash=0
11--FILE--
12<?php
13include dirname(__FILE__) . '/files/tarmaker.php.inc';
14
15$fname = dirname(__FILE__) . '/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===DONE===
34--CLEAN--
35<?php
36@unlink(dirname(__FILE__) . '/tar_004.phar.tar');
37?>
38--EXPECTF--
39string(9) "it worked"
40string(%d) "phar://%star_004.phar.tar/tar_004.php"
41===DONE===
42