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