xref: /PHP-7.2/ext/phar/tests/tar/tar_gzip.phpt (revision 113213f0)
1--TEST--
2Phar: tar-based phar, gzipped tar
3--SKIPIF--
4<?php
5if (!extension_loaded("phar")) die("skip");
6if (!extension_loaded("spl")) die("skip SPL not available");
7if (!extension_loaded("zlib")) die("skip zlib not available");
8?>
9--INI--
10phar.readonly=0
11phar.require_hash=0
12--FILE--
13<?php
14include dirname(__FILE__) . '/files/tarmaker.php.inc';
15$fname = dirname(__FILE__) . '/tar_gzip.phar';
16$pname = 'phar://' . $fname;
17$fname2 = dirname(__FILE__) . '/tar_gzip.phar.tar';
18$pname2 = 'phar://' . $fname2;
19
20$a = new tarmaker($fname, 'zlib');
21$a->init();
22$a->addFile('tar_004.php', '<?php var_dump(__FILE__);');
23$a->addFile('internal/file/here', "hi there!\n");
24$a->mkDir('internal/dir');
25$a->mkDir('dir');
26$a->addFile('.phar/stub.php', '<?php
27Phar::mapPhar();
28var_dump("it worked");
29include "phar://" . __FILE__ . "/tar_004.php";
30');
31$a->close();
32
33include $fname;
34
35$a = new Phar($fname);
36$a['test'] = 'hi';
37copy($fname, $fname2);
38$b = new Phar($fname2);
39var_dump($b->isFileFormat(Phar::TAR));
40var_dump($b->isCompressed() == Phar::GZ);
41?>
42===DONE===
43--CLEAN--
44<?php
45@unlink(dirname(__FILE__) . '/tar_gzip.phar');
46@unlink(dirname(__FILE__) . '/tar_gzip.phar.tar');
47?>
48--EXPECTF--
49string(9) "it worked"
50string(%d) "phar://%star_gzip.phar/tar_004.php"
51bool(true)
52bool(true)
53===DONE===
54