xref: /PHP-8.0/ext/phar/tests/tar/tar_makegz.phpt (revision a555cc0b)
1--TEST--
2Phar: tar-based phar, make new gzipped tar
3--SKIPIF--
4<?php if (!extension_loaded('phar')) die('skip'); ?>
5<?php if (!extension_loaded("zlib")) die("skip zlib not available"); ?>
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