xref: /PHP-7.0/ext/phar/tests/tar/tar_makegz.phpt (revision 16b4d8e0)
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("spl")) die("skip SPL not available"); ?>
6<?php if (!extension_loaded("zlib")) die("skip zlib not available"); ?>
7--INI--
8phar.readonly=0
9--FILE--
10<?php
11
12$fname = dirname(__FILE__) . '/tar_makegz.phar.tar';
13$fname2 = dirname(__FILE__) . '/tar_makegz.phar.tar.gz';
14$fname3 = dirname(__FILE__) . '/tar_makegz_b.phar.tar.gz';
15
16$phar = new Phar($fname);
17$phar['test'] = 'hi';
18var_dump($phar->isFileFormat(Phar::TAR));
19$phar = $phar->compress(Phar::GZ);
20
21
22copy($fname2, $fname3);
23
24$phar2 = new Phar($fname3);
25var_dump($phar2->isFileFormat(Phar::TAR));
26var_dump($phar2->isCompressed() == Phar::GZ);
27
28?>
29===DONE===
30--CLEAN--
31<?php
32@unlink(dirname(__FILE__) . '/tar_makegz.phar.gz');
33@unlink(dirname(__FILE__) . '/tar_makegz.phar.tar');
34@unlink(dirname(__FILE__) . '/tar_makegz.phar.tar.gz');
35@unlink(dirname(__FILE__) . '/tar_makegz_b.phar.tar.gz');
36?>
37--EXPECTF--
38bool(true)
39bool(true)
40bool(true)
41===DONE===