Annotation of embedaddon/php/ext/phar/tests/tar/phar_convert_phar.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Phar::convertToPhar() from tar
3: --SKIPIF--
4: <?php if (!extension_loaded("phar")) die("skip"); ?>
5: --INI--
6: phar.require_hash=0
7: phar.readonly=0
8: --FILE--
9: <?php
10:
11: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar';
12: $fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.phar';
13: $fname3 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.3.phar';
14:
15: $phar = new Phar($fname);
16: $phar['a.txt'] = 'some text';
17: $phar->stopBuffering();
18: var_dump($phar->isFileFormat(Phar::TAR));
19: var_dump(strlen($phar->getStub()));
20:
21: $phar = $phar->convertToExecutable(Phar::TAR);
22: var_dump($phar->isFileFormat(Phar::TAR));
23: var_dump($phar->getStub());
24:
25: $phar['a'] = 'hi there';
26:
27: $phar = $phar->convertToExecutable(Phar::PHAR, Phar::NONE, '.3.phar');
28: var_dump($phar->isFileFormat(Phar::PHAR));
29: var_dump(strlen($phar->getStub()));
30:
31: copy($fname3, $fname2);
32:
33: $phar = new Phar($fname2);
34: var_dump($phar->isFileFormat(Phar::PHAR));
35: var_dump(strlen($phar->getStub()));
36:
37: ?>
38: ===DONE===
39: --CLEAN--
40: <?php
41: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar');
42: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar');
43: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.tar');
44: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.phar');
45: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.3.phar');
46: __HALT_COMPILER();
47: ?>
48: --EXPECT--
49: bool(false)
50: int(6683)
51: bool(true)
52: string(60) "<?php // tar-based phar archive stub file
53: __HALT_COMPILER();"
54: bool(true)
55: int(6683)
56: bool(true)
57: int(6683)
58: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>