Annotation of embedaddon/php/ext/phar/tests/tar/tar_bz2U.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Phar: tar-based phar, bzipped tar
3: --SKIPIF--
4: <?php
5: if (!extension_loaded("phar")) die("skip");
6: if (version_compare(PHP_VERSION, "6.0", "<")) die("skip Unicode support required");
7: if (!extension_loaded("spl")) die("skip SPL not available");
8: if (!extension_loaded("bz2")) die("skip bz2 not available");
9: ?>
10: --INI--
11: phar.readonly=0
12: phar.require_hash=0
13: --FILE--
14: <?php
15: include dirname(__FILE__) . '/files/tarmaker.php.inc';
16:
17: $fname = dirname(__FILE__) . '/tar_bz2U.phar';
18: $alias = 'phar://' . $fname;
19: $fname2 = dirname(__FILE__) . '/tar_bz2U.phar.tar';
20: $alias2 = 'phar://' . $fname2;
21:
22: $tar = new tarmaker($fname, 'bz2');
23: $tar->init();
24: $tar->addFile('tar_004.php', '<?php var_dump(__FILE__);');
25: $tar->addFile('internal/file/here', "hi there!\n");
26: $tar->mkDir('internal/dir');
27: $tar->mkDir('dir');
28: $tar->addFile('.phar/stub.php', '<?php
29: var_dump(__FILE__);
30: var_dump(substr(__FILE__, 0, 4) != "phar");
31: Phar::mapPhar();
32: var_dump("it worked");
33: include "phar://" . __FILE__ . "/tar_004.php";
34: __HALT_COMPILER();
35: ');
36: $tar->close();
37:
38: include $alias;
39:
40: $phar = new Phar($fname);
41: $phar['test'] = 'hi';
42:
43: copy($fname, $fname2);
44:
45: $phar2 = new Phar($fname2);
46: var_dump($phar2->isFileFormat(Phar::TAR));
47: var_dump($phar2->isCompressed() == Phar::BZ2);
48:
49: ?>
50: ===DONE===
51: --CLEAN--
52: <?php
53: @unlink(dirname(__FILE__) . '/tar_bz2U.phar');
54: @unlink(dirname(__FILE__) . '/tar_bz2U.phar.tar');
55: ?>
56: --EXPECTF--
57: unicode(%d) "%star_bz2U.phar"
58: bool(true)
59: unicode(9) "it worked"
60: unicode(%d) "phar://%star_bz2U.phar/tar_004.php"
61: bool(true)
62: bool(true)
63: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>