xref: /PHP-8.2/ext/phar/tests/tar/tar_makegz.phpt (revision 74859783)
1--TEST--
2Phar: tar-based phar, make new gzipped tar
3--EXTENSIONS--
4phar
5zlib
6--INI--
7phar.readonly=0
8--FILE--
9<?php
10
11$fname = __DIR__ . '/tar_makegz.phar.tar';
12$fname2 = __DIR__ . '/tar_makegz.phar.tar.gz';
13$fname3 = __DIR__ . '/tar_makegz_b.phar.tar.gz';
14
15$phar = new Phar($fname);
16$phar['test'] = 'hi';
17var_dump($phar->isFileFormat(Phar::TAR));
18$phar = $phar->compress(Phar::GZ);
19
20
21copy($fname2, $fname3);
22
23$phar2 = new Phar($fname3);
24var_dump($phar2->isFileFormat(Phar::TAR));
25var_dump($phar2->isCompressed() == Phar::GZ);
26
27?>
28--CLEAN--
29<?php
30@unlink(__DIR__ . '/tar_makegz.phar.gz');
31@unlink(__DIR__ . '/tar_makegz.phar.tar');
32@unlink(__DIR__ . '/tar_makegz.phar.tar.gz');
33@unlink(__DIR__ . '/tar_makegz_b.phar.tar.gz');
34?>
35--EXPECT--
36bool(true)
37bool(true)
38bool(true)
39