Annotation of embedaddon/php/ext/phar/tests/phar_decompress.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Phar::decompress()
3: --SKIPIF--
4: <?php if (!extension_loaded("phar")) die("skip"); ?>
5: <?php if (!extension_loaded("zlib")) die("skip zlib not present"); ?>
6: --INI--
7: phar.require_hash=0
8: phar.readonly=0
9: --FILE--
10: <?php
11: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
12: $fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '2.phar.gz';
13: $pname = 'phar://' . $fname;
14: $file = '<?php __HALT_COMPILER(); ?>';
15:
16: $files = array();
17: $files['a'] = 'a';
18: $files['b'] = 'b';
19: $files['c'] = 'c';
20:
21: include 'files/phar_test.inc';
22:
23: $phar = new Phar($fname);
24:
25: $gz = $phar->compress(Phar::GZ);
26: copy($gz->getPath(), $fname2);
27: $a = new Phar($fname2);
28: var_dump($a->isCompressed());
29: $unc = $a->compress(Phar::NONE);
30: echo $unc->getPath() . "\n";
31: $unc2 = $gz->decompress();
32: echo $unc2->getPath() . "\n";
33: $unc3 = $gz->decompress('hooba.phar');
34: echo $unc3->getPath() . "\n";
35: $gz->decompress(array());
36: $zip = $phar->convertToData(Phar::ZIP);
37: ini_set('phar.readonly', 1);
38: try {
39: $gz->decompress();
40: } catch (Exception $e) {
41: echo $e->getMessage() . "\n";
42: }
43: try {
44: $zip->decompress();
45: } catch (Exception $e) {
46: echo $e->getMessage() . "\n";
47: }
48: ?>
49: ===DONE===
50: --CLEAN--
51: <?php
52: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
53: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.zip');
54: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.hooba.phar');
55: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar');
56: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.gz');
57: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '2.phar.gz');
58: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '2.phar');
59: ?>
60: --EXPECTF--
61: int(4096)
62: %sphar_decompress2.phar
63: %sphar_decompress.phar
64: %sphar_decompress.hooba.phar
65:
66: Warning: Phar::decompress() expects parameter 1 to be %string, array given in %sphar_decompress.php on line %d
67: Cannot decompress phar archive, phar is read-only
68: Cannot decompress zip-based archives with whole-archive compression
69: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>