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