xref: /PHP-8.3/ext/phar/tests/tar/tar_makebz2.phpt (revision 74859783)
1--TEST--
2Phar: tar-based phar, make new bzipped tar
3--EXTENSIONS--
4phar
5bz2
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--CLEAN--
28<?php
29@unlink(__DIR__ . '/tar_makebz2.phar.bz2');
30@unlink(__DIR__ . '/tar_makebz2.phar.tar');
31@unlink(__DIR__ . '/tar_makebz2.phar.tar.bz2');
32@unlink(__DIR__ . '/tar_makebz2_b.phar.tar.bz2');
33?>
34--EXPECT--
35bool(true)
36bool(true)
37bool(true)
38