xref: /PHP-5.3/ext/phar/tests/tar/tar_gzip.phpt (revision 377ff97a)
1--TEST--
2Phar: tar-based phar, gzipped tar
3--SKIPIF--
4<?php
5if (!extension_loaded("phar")) die("skip");
6if (version_compare(PHP_VERSION, "6.0", ">")) die("skip pre-unicode version of PHP required");
7if (!extension_loaded("spl")) die("skip SPL not available");
8if (!extension_loaded("zlib")) die("skip zlib not available");
9if (version_compare(phpversion(), '5.2.6', '<')) die("skip zlib is buggy in PHP < 5.2.6");
10?>
11--INI--
12phar.readonly=0
13phar.require_hash=0
14--FILE--
15<?php
16include dirname(__FILE__) . '/files/tarmaker.php.inc';
17$fname = dirname(__FILE__) . '/tar_gzip.phar';
18$pname = 'phar://' . $fname;
19$fname2 = dirname(__FILE__) . '/tar_gzip.phar.tar';
20$pname2 = 'phar://' . $fname2;
21
22$a = new tarmaker($fname, 'zlib');
23$a->init();
24$a->addFile('tar_004.php', '<?php var_dump(__FILE__);');
25$a->addFile('internal/file/here', "hi there!\n");
26$a->mkDir('internal/dir');
27$a->mkDir('dir');
28$a->addFile('.phar/stub.php', '<?php
29Phar::mapPhar();
30var_dump("it worked");
31include "phar://" . __FILE__ . "/tar_004.php";
32');
33$a->close();
34
35include $fname;
36
37$a = new Phar($fname);
38$a['test'] = 'hi';
39copy($fname, $fname2);
40$b = new Phar($fname2);
41var_dump($b->isFileFormat(Phar::TAR));
42var_dump($b->isCompressed() == Phar::GZ);
43?>
44===DONE===
45--CLEAN--
46<?php
47@unlink(dirname(__FILE__) . '/tar_gzip.phar');
48@unlink(dirname(__FILE__) . '/tar_gzip.phar.tar');
49?>
50--EXPECTF--
51string(9) "it worked"
52string(%d) "phar://%star_gzip.phar/tar_004.php"
53bool(true)
54bool(true)
55===DONE===