Annotation of embedaddon/php/ext/phar/tests/phar_convert_tar2.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Phar::convertToTar() gzip compressed
3: --SKIPIF--
4: <?php if (!extension_loaded("phar")) die("skip"); ?>
5: <?php if (!extension_loaded("zlib")) die("skip"); ?>
6: --INI--
7: phar.require_hash=0
8: phar.readonly=0
9: --FILE--
10: <?php
11:
12: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
13: $pname = 'phar://' . $fname;
14: $fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar.gz';
15: $fname3 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.phar.tar';
16: $stub = '<?php echo "first stub\n"; __HALT_COMPILER(); ?>';
17: $file = $stub;
18:
19: $files = array();
20: $files['a'] = 'a';
21: $files['b'] = 'b';
22: $files['c'] = 'c';
23:
24: include 'files/phar_test.inc';
25:
26: $phar = new Phar($fname);
27: var_dump($phar->isFileFormat(Phar::TAR));
28: var_dump($phar->isCompressed());
29: var_dump($phar->getStub());
30:
31: $phar = $phar->convertToExecutable(Phar::TAR, Phar::GZ);
32: var_dump($phar->isFileFormat(Phar::TAR));
33: var_dump($phar->isCompressed());
34: var_dump($phar->getStub());
35:
36: copy($fname2, $fname3);
37:
38: $phar = new Phar($fname3);
39: var_dump($phar->isFileFormat(Phar::TAR));
40: var_dump($phar->isCompressed() == Phar::GZ);
41: var_dump($phar->getStub());
42:
43: ?>
44: ===DONE===
45: --CLEAN--
46: <?php
47: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar.gz');
48: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar');
49: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.phar.tar');
50: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
51: ?>
52: --EXPECT--
53: bool(false)
54: bool(false)
55: string(48) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>"
56: bool(true)
57: int(4096)
58: string(60) "<?php // tar-based phar archive stub file
59: __HALT_COMPILER();"
60: bool(true)
61: bool(true)
62: string(60) "<?php // tar-based phar archive stub file
63: __HALT_COMPILER();"
64: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>