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