xref: /PHP-5.4/ext/phar/tests/phar_gzipU.phpt (revision 377ff97a)
1--TEST--
2Phar: gzipped phar
3--SKIPIF--
4<?php
5if (!extension_loaded("phar")) die("skip");
6if (version_compare(PHP_VERSION, "6.0", "<")) die("skip Unicode support 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
16$fname = dirname(__FILE__) . '/phar_gzip.phar';
17$pname = 'phar://' . $fname;
18$fname2 = dirname(__FILE__) . '/phar_gzip.2.phar';
19$pname2 = 'phar://' . $fname2;
20
21$file = '<?php
22Phar::mapPhar();
23var_dump("it worked");
24include "phar://" . __FILE__ . "/tar_004.php";
25__HALT_COMPILER();';
26
27$files = array();
28$files['tar_004.php']   = '<?php var_dump(__FILE__);';
29$files['internal/file/here']   = "hi there!\n";
30$files['internal/dir/'] = '';
31$files['dir/'] = '';
32$gzip = true;
33
34include 'files/phar_test.inc';
35
36include $fname;
37
38$a = new Phar($fname);
39$a['test'] = 'hi';
40copy($fname, $fname2);
41$a->setAlias('another');
42$b = new Phar($fname2);
43var_dump($b->isFileFormat(Phar::PHAR));
44var_dump($b->isCompressed() == Phar::GZ);
45?>
46===DONE===
47--CLEAN--
48<?php
49@unlink(dirname(__FILE__) . '/phar_gzip.phar');
50@unlink(dirname(__FILE__) . '/phar_gzip.2.phar');
51?>
52--EXPECTF--
53unicode(9) "it worked"
54unicode(%d) "phar://%sphar_gzip.phar/tar_004.php"
55bool(true)
56bool(true)
57===DONE===