xref: /php-src/ext/phar/tests/tar/tar_bz2.phpt (revision 74859783)
1--TEST--
2Phar: tar-based phar, bzipped tar
3--EXTENSIONS--
4phar
5bz2
6--INI--
7phar.readonly=0
8phar.require_hash=0
9--FILE--
10<?php
11include __DIR__ . '/files/tarmaker.php.inc';
12
13$fname = __DIR__ . '/tar_bz2.phar';
14$alias = 'phar://' . $fname;
15$fname2 = __DIR__ . '/tar_bz2.phar.tar';
16$alias2 = 'phar://' . $fname2;
17
18$tar = new tarmaker($fname, 'bz2');
19$tar->init();
20$tar->addFile('tar_004.php', '<?php var_dump(__FILE__);');
21$tar->addFile('internal/file/here', "hi there!\n");
22$tar->mkDir('internal/dir');
23$tar->mkDir('dir');
24$tar->addFile('.phar/stub.php', '<?php
25var_dump(__FILE__);
26var_dump(substr(__FILE__, 0, 4) != "phar");
27Phar::mapPhar();
28var_dump("it worked");
29include "phar://" . __FILE__ . "/tar_004.php";
30__HALT_COMPILER();
31');
32$tar->close();
33
34include $alias;
35
36$phar = new Phar($fname);
37$phar['test'] = 'hi';
38
39copy($fname, $fname2);
40
41$phar2 = new Phar($fname2);
42var_dump($phar2->isFileFormat(Phar::TAR));
43var_dump($phar2->isCompressed() == Phar::BZ2);
44
45?>
46--CLEAN--
47<?php
48@unlink(__DIR__ . '/tar_bz2.phar');
49@unlink(__DIR__ . '/tar_bz2.phar.tar');
50?>
51--EXPECTF--
52string(%d) "%star_bz2.phar"
53bool(true)
54string(9) "it worked"
55string(%d) "phar://%star_bz2.phar/tar_004.php"
56bool(true)
57bool(true)
58