Annotation of embedaddon/php/ext/phar/tests/phar_oo_compressed_001.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Phar: PharFileInfo::compress(Phar::GZ)
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: $pname = 'phar://' . $fname;
13: $file = '<?php __HALT_COMPILER(); ?>';
14:
15: $files = array();
16: $files['a'] = 'a';
17: $files['b'] = 'b';
18: $files['c'] = 'c';
19:
20: include 'files/phar_test.inc';
21:
22: $phar = new Phar($fname);
23:
24: var_dump(file_get_contents($pname . '/a'));
25: var_dump($phar['a']->isCompressed());
26: var_dump(file_get_contents($pname . '/b'));
27: var_dump($phar['b']->isCompressed());
28: var_dump(file_get_contents($pname . '/c'));
29: var_dump($phar['c']->isCompressed());
30:
31: $phar['a'] = 'new a';
32: $phar['a']->decompress();
33: $phar['b'] = 'new b';
34: $phar['b']->compress(Phar::GZ);
35: $phar['d'] = 'new d';
36:
37: $phar = new Phar($fname);
38: var_dump(file_get_contents($pname . '/a'));
39: var_dump($phar['a']->isCompressed());
40: var_dump(file_get_contents($pname . '/b'));
41: var_dump($phar['b']->isCompressed());
42: var_dump(file_get_contents($pname . '/c'));
43: var_dump($phar['c']->isCompressed());
44: var_dump(file_get_contents($pname . '/d'));
45: var_dump($phar['d']->isCompressed());
46:
47: ?>
48: ===DONE===
49: --CLEAN--
50: <?php
51: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
52: ?>
53: --EXPECTF--
54: string(1) "a"
55: bool(false)
56: string(1) "b"
57: bool(false)
58: string(1) "c"
59: bool(false)
60: string(5) "new a"
61: bool(false)
62: string(5) "new b"
63: bool(true)
64: string(1) "c"
65: bool(false)
66: string(5) "new d"
67: bool(false)
68: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>