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